Here’s a tiny snippet I wrote that some may find useful. I called it [[GetChildID]].
It returns the ID of a child folder with a specific name. I use this in the Ditto &startID variable, you can use it how you wish.
The call is:
[[GetChildID?&childsName=`SubfolderName`]]
The snippet code is:
<?php
$docid = (isset($docid)) ? $docid: $modx->documentIdentifier;
$children= $modx->getActiveChildren($docid, 'id', 'ASC');
foreach($children as $value){
if($value['pagetitle']==$childsName){
$childsID= $value['id'];
return $childsID;
break;
}
}
?>