A programmer has hacked DropMenu for a split menu on our site. It allows to get the first parent of the menu, like an automatic startDoc.
In the dropmenu snippet, paste the followings.
In configuration parameters:
// $startFromParent [ true | false ]
// If true, get the first parent of menu. Like an automatic startDoc
// [[DropMenu?parentID]]
$startFromParent = (!isset($startFromParent)) ? false : ($startFromParent==true);
Below "End config, the rest takes bare of itself"
if($startFromParent==true)
{
// document id
$cid = $modx->documentObject['id'];
// document parent
$pid = $modx->getParent($cid,1,"id");
$ptarr=array();
$ptarr[]=$cid;
while ($parent=$modx->getPageInfo($pid['id']))
{
$ptarr[]=$parent['id'];
$pid = $modx->getParent($parent['id'],1,"id");
}
$ptarr = array_reverse($ptarr);
$startDoc=$ptarr[0];
}