Skip to content

Instantly share code, notes, and snippets.

@sonicpunk
Created May 29, 2013 13:34
Show Gist options
  • Save sonicpunk/5670292 to your computer and use it in GitHub Desktop.
Save sonicpunk/5670292 to your computer and use it in GitHub Desktop.
MODX snippet:returns the level of a resource
<?php
$id = isset($id) ? $id : $modx->resource->get('id');
$pids = $modx->getParentIds($id, 100, array('context' => 'web'));
return count($pids);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment