Разделы

  
 

Вывод случайных документов средствами DItto.

В голову приходит только такой способ, но он не реально кривой.

<?php
$results = $modx->getDocumentChildren($id = $rootID,$active = 1,$deleted = 0,'id',$where = '',$sort='',$dir='',$limit = '');
shuffle($results);
for($i=0;$i<$countItem;$i++){
  if($i==0){
   $s.= $results[$i]['id'];
  }else{
    $s.= ', '.$results[$i]['id'];
  }
}
echo $modx->runSnippet('Ditto', array('startID' => $rootID, 'documents'=>$s, 'tpl'=>$tpl' ));
?>


Вызов [!RandChildren? &rootID=`6` &countItem=`2` &tpl=`TPL_ROW_PARTNERS` !]
  • +2
  • 3 сентября 2009, 11:26
  • chus
  • 9