Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.
X

Getting Parent Page Title in Modx Evolution

I spent alomst 3 hours figuring out how to get parent's title of a document in Modx Evolution without doing much hack and writing snippets. I surf the internet for so long not until I almost gave up that I got an article that helped out. This is the link http://cipalabs.com/modx/articles/get-the-parent to the article.

The article gave 11 examples of getting the parent and this gave me better insight into solving my problem.

Below is how I solved the problem eaisly.

1. Create a snippet with the name parentPageTitle

2. Copy and paste the code below into your snippet

<?php

/*getParent*/
$parent = $modx->getParent($modx->documentIdentifier,'','pagetitle');
return $parent['pagetitle'];

?>

3. Go into your template and call

 

Hope this helps someone...

 

 


comments powered by Disqus