[!Wayfinder? &debug=`1` &startID=`[[UltimateParent]]` &hideSubMenus=`true` &outerClass=`leftmenu` &rowTpl=`wfRowTpl` &selfClass=`self`!]
use &startId instead of &startID
[...]
[!Wayfinder? &debug=`1` &startID=`[[UltimateParent]]` &hideSubMenus=`true` &outerClass=`leftmenu` &rowTpl=`wfRowTpl` &selfClass=`self`!]
[...]
<div class="leftmenu">
[[Wayfinder? &startId=`3` &level=`1` &hideSubMenus=`true` &outerClass=`nav1`!]]
</div>
<div id="headernav">
[[Wayfinder? &startId=`0` &level=`1` &hideSubMenus=`true` &outerClass=`nav2`!]]
</div>
<div id="headersubnav">
[!Wayfinder? &startID=`[[UltimateParent]]` &level=`1` &hideSubMenus=`true` &outerClass=`nav2`!]
</div><?php /** * @name UltimateParent * @version 2.0 beta (requires MODx 0.9.5+) * @author Jason Coward <[email protected]> * * @param &id The id of the document whose parent you want to find. * @param &top The top node for the search. * @param &topLevel The top level node for the search (root = level 1) * @param &alias Boolean for returning the alias of a page instead of its number. * @param &chunk The name of the chunk combining with the alias * * @license Public Domain, use as you like. * * @example [[UltimateParent? &id=`45` &top=`6`]] * Will find the ultimate parent of document 45 if it is a child of document 6; * otherwise it will return 45. * * @example [[UltimateParent? &topLevel=`2`]] * Will find the ultimate parent of the current document at a depth of 2 levels * in the document hierarchy, with the root level being level 1. * * @example [[UltimateParent? &alias=`1` &chunk='sidebar-']] * Will find the alias of the parent page, for example 'products' * and then insert it into a chunk command: * {{sidebar-products}}. * This allows you to specify a single chunk to be used in all children pages. * * This snippet travels up the document tree from a specified document and * returns the "ultimate" parent. Version 2.0 was rewritten to use the new * getParentIds function features available only in MODx 0.9.5 or later. * * Based on the original UltimateParent 1.x snippet by Susan Ottwell * <[email protected]>. The topLevel parameter was introduced by staed and * adopted here. */ $top= isset ($top) && intval($top) ? $top : 0; $alias= isset ($alias) && intval($alias) ? $alias : 0; $chunk= isset ($alias) && isset ($chunk) ? $chunk : ""; $id= isset ($id) && intval($id) ? intval($id) : $modx->documentIdentifier; $topLevel= isset ($topLevel) && intval($topLevel) ? intval($topLevel) : 0; if ($id && $id != $top) { $pid= $id; if (!$topLevel || count($modx->getParentIds($id)) >= $topLevel) { while ($parentIds= $modx->getParentIds($id, 1)) { $pid= array_pop($parentIds); if ($pid == $top) { break; } $id= $pid; if ($topLevel && count($modx->getParentIds($id)) < $topLevel) { break; } } } } if ($alias != 0) { $parent = $modx->getPageInfo($id,1,"alias"); $alias = $parent['alias']; return '{{'$chunk.$alias.'}}'; } else { return $id; } ?>
[[UltimateParent? top=`[[++site_start]]`]]
[[!Wayfinder? &startId=`[[UltimateParent? top=`[[++site_start]]`]]`]]
return '{{'.$chunk.$alias.'}}';