-
- 24,544 Posts
Quote from: sunwukung at Nov 17, 2010, 11:02 AM
Here’s a variation on mrhaw’s using revo:
$parentID = $modx->resource->get('parent');
$document = $modx->getObject('modResource',array(
'id' => $parentID,
));
return $document->get('pagetitle');
Let me tweak that Revo version slightly:
<?php
$parentObj = $modx->resource->getOne('Parent');
return $parentObj->get('pagetitle');
-
- 41 Posts
For my needs I did it this way:
[[*parent:ne=`0`:then=`Parent page: <a href="[[~[[*parent]]~]]">[[getResourceField? &id=`[[*parent]]`]]</a>`:else=``]]
If parent exists it will display it, unless the parent is home page (id=0).
-
- 24,544 Posts
Simon, your snippet would be much faster and more efficient.