Created
January 24, 2012 13:05
-
-
Save pepebe/1670095 to your computer and use it in GitHub Desktop.
MODX: How to find how many parents a document has?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question by: highlander | |
Is there a way to know how many parents any given document has or, how far down the tree structure a document is located? | |
Solution by: opengeek | |
Updated by: pepebe to work with MODX REVO 2.2.0-pl2 | |
Source: http://forums.modx.com/index.php?topic=18747.0;wap2 | |
noOfParents snippet: | |
<?php | |
$id = isset($id) ? $id : $modx->resource->get('id'); | |
$pids = $modx->getParentIds($id, 100, array('context' => 'de')); | |
return count($pids); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sidenote: You may remove the paramter part (array(...) if you are content with your current context.