Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $time_start = microtime(true);
- $c = $modx->newQuery('modResource');
- $c->select(array('id','pagetitle','longtitle','content'));
- $c->where(array('id:>=' => 6));
- $c->limit(1000);
- if($c->prepare() && $c->stmt->execute()) {
- $collection = $c->stmt->fetchAll(PDO::FETCH_ASSOC);
- }
- $output = array();
- $i=0;
- foreach ($collection as $res) {
- $output[] = $modx->getChunk('tpl',$res);
- $i++;
- }
- $output = implode("\n",$output);
- echo $output;
- $time_end = microtime(true);
- $time = $time_end - $time_start;
- echo 'Ресурсов: ' . $i . '<br />';
- echo 'Памяти скушано: ' . round(memory_get_peak_usage(true)/(1024*1024),2) . 'Мб<br />';
- echo 'Время работы сниппета ' . $time . ' сек <br />';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement