What can I use to get the page title of the parent document to display?
I can use this to get the ID:
[+parent+]
But what can I use to get the page title of the parent?
I’ll be using it like this:
<a href="[~[+parent+]~]">[+pagetitleofparent+]</a>
[+pagetitleofparent+] is obviously incorrect. I need to do this without needing to create a template variable (TV).
Is it possible to combine document variables? [+pagetitle+] + [+parent+] = [+pagetitleofparent+]. (If not, that sounds like a cool feature request to me... a lot of possibilities there)
Thanks in advance!
The following snippet will return the page title of the parent document:
<?php
$docInfo=$modx->getDocument($modx->documentObject['parent'],'pagetitle');
return $docInfo['pagetitle'];
?>
Thanks for the replies I was able to do it with just the GetField snippet:
<a href="[~[+parent+]~]">[[GetField? &docid=`[+parent+]` field=`pagetitle`]]</a>