I've utilised the listMyResources snippet from
http://rtfm.modx.com/display/revolution20/Creating+a+multi-select+box+for+related+pages+in+your+template
Overall it works perfectly, but we have been asked if we can make the documents sort alphabetically rather than by the order they are added.
I'm no PHP bod, so perhaps someone can point me in the rright direction - for ease ive posted the code below.
TIA
$parent = $modx->getOption('parent',$scriptProperties,9);
$parentObj = $modx->getObject('modResource',$parent);
if (!($parentObj instanceof modResource)) { return ''; }
$resArray = $parentObj->getMany('Children');
$resources = array();
foreach($resArray as $res) {
if ($res instanceof modResource) {
$resources[] = $res->get('pagetitle') . '==' . $res->get('id');
}
}
$out = implode("||",$resources);
return $out;