Get all parents of a resource, return the id at a specific level.
<?php
/*Usage [[getParentIds? &level=`1`]]
*/
$level = !empty($level) ? $level : 1;
$arr = array_reverse($modx->getParentIds($modx->resource->get('id'), 10, array('context' => 'web')));
return $arr[$level];