This is a solution about a problem that I have trying to find a way to identify the depth level of a children page.
very useful if you want to display code depending where the user is in the page, base in children pages.
Snippet Name: depthLevel
code:
<?php
$id = $modx->resource->get('id');
$levelcount = count($modx->getParentIds($id));
$output .= $levelcount;
return $output;
call the snippet: [[!depthLevel]]
It will display the depth number. EASY!!!
Display what you need, using outputs:
http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/customizing-content/input-and-output-filters-(output-modifiers)
Thanks to:
http://pm-fx.com/en/blog/2011/modx-checking-document-depth#jfe06d4c1b