pepebe
4/24/2012 - 9:27 PM

MODx: MODx Revolution getMany Children

MODx: MODx Revolution getMany Children

Source: http://www.unchi.co.uk/2010/11/16/modx-revolution-getmany-children/

BY KEIRON – 16/11/2010
The following code allows the retrieval of child document for the page the user is on.

$criteria = $modx->newQuery('modResource');
$criteria->where(array(
'parent' => $modx->resource->get('id'),
'published' => 1,
'deleted' => 0,
));
$criteria->sortby('pagetitle','ASC');
$children = $modx->resource->getMany('Children',$criteria);

foreach($children as $var => $value)
{

}