whith this function return true if the mainid called ($id) has in site tree down a folder ($hasid) cold do usefoul for restrict snippets or plugins to a top parent and aply the code if the parent and subparents... have the final id ($hasid) if havent return false and the code dont exec.
function hasId($id,$hasid){
global $modx;
$pid = $modx->getDocument($id,’id’);
while ($pid[’id’] != 0) {
$id = $pid[’id’];
$pid = $modx->getParent($id,1,’id’);
if($pid[’id’] == $hasid) { return true ;}
}
return false; // if all else fails
}