Hi
I’m looking for a way to get not just the ID, but the title of the ultimate parent of the current Document. This means I’d probably have to call the snippet from PHP myself? Not sure where to do that. Are there som API functions I missed?
Thank you
Philip Whitfield
my solution
create a snippet and modify the following code to fit your needs
<?php
$parent = $modx->runSnippet(
"UltimateParent",
array(
"topLevel" => 2
)
);
$atvs = array(’pagetitle’,’longtitle’);
$tvs = $modx->getTemplateVarOutput($atvs,$parent);
echo $tvs[’pagetitle’];
// OR
//echo $tvs[’longtitle’];
?>
In my case I used topLevel=2. You can use whatever you need.
nice to know that there is a simpler way. Thx
Perfect. The GetField snippet did the job.
Thanks for your quick answers. (Topic closed)