
<?php
$parentId = $modx->documentObject['parent']; // get the parent's ID
$parentObject = $modx->getDocumentObject('id',$parentId); // get the parent object
$grandparentId = $parentObject['parent']; // get the parent object's parent field (i.e. grandparent's id)
/* if you want to go further */
$grandparentObject = $modx->getDocumentObject('id',$grandparentId);
$greatGrandparentId = $grandparentObject['parent'];
// use the grandparent ID in the ditto call
$ditto_output = $modx->runSnippet("Ditto", array(
"parents" => $grandparentId,
"tpl" => "tplsubNavfeatured",
"noResults" => "tplnoResults",
"sortBy" => "menuindex",
"sortDir" => "ASC"));
// output the ditto results
return $ditto_output;
?>
I just want to give you a huge and simple THANK YOU you have really helped me on this, worked perfectly!
Got room for one more wrapper zinger??
Thanks in advanced for looking at this at least! I really appreciate it.
<?php
// identify the parent
$parent = $modx -> documentObject['parent'];
$kids = getDocumentChildren($parent);
$numKids = count($kids);
/* if $parent (is) container (or does it matter?) and has 1 child or less) display = (empty). */
if ($numKids <= 1) {
$wayfinder_output = '';
} else {
/* elseif $parent (container has 2 children or more = $wayfinder_output; */
// use the parent in the ditto call
$wayfinder_output = $modx->runSnippet("Wayfinder", array(
"startId" => $parent,
"level" => "1",
"outerClass" =>"innerway",
"firstClass" => "active first",
"textOfLinks" => "menuindex"));
}
return $wayfinder_output;
?>
// identify the parent
$parent = $modx -> documentObject['id'];
$kids = $modx -> getDocumentChildren($parent); (Added $modx -> )
$numKids = count($kids);
if ($numKids<= 1) { (Changed to $numKids)
$wayfinder_output = '';
} else {
// use the parent in the ditto call
$wayfinder_output = $modx->runSnippet("Wayfinder", array(
"startId" => $parent,
"level" => "1",
"outerClass" =>"innerway",
"firstClass" => "active first",
"textOfLinks" => "menuindex"));
}
return $wayfinder_output;

$parent = $modx->resource->get('parent');
$kids = $modx->getChildIds($parent);