Parent: [[*parent]]
[[!If?
&subject=`[[!GetLevel]]`
&operator=`EQ`
&operand=`1`
&then=``
&else=`[[!If?
&subject=`[[!GetLevel]]`
&operator=`EQ`
&operand=`2`
&then=`[[!Wayfinder? &startId=`[[!If?
&subject=`[[!HasChildren]]`
&operator=`EQ`
&operand=`0`
&then=`[[*parent]]`
&else=`[[*id]]`]]
&rowTpl=`sideNav` &outerTpl=`outerTpl`]]`
&else=`[[!Wayfinder? &startId=`[[*parent]]` &rowTpl=`sideNav` &outerTpl=`outerTpl`]]`
]]`
]]`[[!If? &subject=`2` &operator=`EQ` &operand=`2` &then=`[[!Wayfinder
[[!MySideBar]]
[[!Wayfinder? &startId=`[[+my_start]]` &rowTpl=`sideNav` &outerTpl=`outerTpl`]]
<?php
/* MySideBar snippet */
$level = (integer) $modx->runSnippet('GetLevel');
if ($level == 2) {
if ($modx->resource->hasChildren()) {
$start = $modx->resource->get('parent');
} else {
$start = $modx->resource->get('id');
}
$output = $modx->getChunk('MyWfChunk', array('my_start' => $start));
} else {
$output = '';
}
return $output;<?php
/* MySideBar snippet */
$level = (integer) $modx->runSnippet('GetLevel');
if ($level >= 2) {
if ($modx->resource->hasChildren()) {
$start = $modx->resource->get('id');
} else {
$start = $modx->resource->get('parent');
}
$output = $modx->getChunk('MyWfChunk', array('my_start' => $start));
} else {
$output = '';
}
return $output;$output = "[[!Wayfinder? &startId=`" . $start .
"` &rowTpl=`sideNav` &outerTpl=`outerTpl`]]";