Advertisement
vanchelo

MODX Revo 2.2.5, xPDO

Oct 13th, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <?php
  2. $time_start = microtime(true);
  3. $c = $modx->newQuery('modResource');
  4. $c->select(array('id','pagetitle','longtitle','content'));
  5. $c->where(array('id:>=' => 6));
  6.  
  7. $c->limit(1000);
  8.  
  9. $collection = $modx->getCollection('modResource',$c);
  10.  
  11. $output = array();
  12. $i=0;
  13. foreach ($collection as $res) {
  14.     $res = $res->toArray();
  15.     $output[] = $modx->getChunk('tpl',$res);
  16.     $i++;
  17. }
  18.  
  19. $output = implode("\n",$output);
  20.  
  21. echo $output;
  22.  
  23. $time_end = microtime(true);
  24. $time = $time_end - $time_start;
  25. echo 'Ресурсов: ' . $i . '<br />';
  26. echo 'Памяти скушано: ' . round(memory_get_peak_usage(true)/(1024*1024),2) . 'Мб<br />';
  27. echo 'Время работы сниппета ' . $time . ' сек <br />';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement