<title>[(site_name)] | [*parent_title*] | [*pagetitle*]</title>
But how do you get the parent title, and how do I make it check to see its not empty?
[*pagetitle*][*parent:isnot=`0`:then=` | [*id:parent*]`*]
<?php
//specify page id you want to get data for
$getID = $getID;
//get content field for page id
$tvOutput = $modx->getTemplateVarOutput(’pagetitle’, $getID);
$content = $tvOutput[’pagetitle’];
//output the data to wherever the snippet is being called
return $content;
?>
[!parentTitle? &getID = `[*parent*]`!]
@rabimoe Install the » IF « snippet http://modxcms.com/forums/index.php/topic,43668.msg260591.html#msg260591
-------
http://svn.modxcms.com/docs/display/revolution/Input+and+Output+Filters
http://modxcms.com/forums/index.php/topic,48059.msg281753.html#msg281753
Hi,
Recently I was unable to make PHx work in 1.0.4, I believe I installed it correctly and tried to use the code above.
I figured out how to display the parent title using a simple snippet based on repo-1628 by William Ashworth.
Here is the snippet code:
<?php
//specify page id you want to get data for
$getID = $getID;
//get content field for page id
$tvOutput = $modx->getTemplateVarOutput(’pagetitle’, $getID);
$content = $tvOutput[’pagetitle’];
//output the data to wherever the snippet is being called
return $content;
?>
and here is the snippet call in my template:
[!parentTitle? &getID = `[*parent*]`!]
it works for me.
hopefully this may help......
<?php //get parent $parentID = $modx->documentObject['parent']; $docObject = $modx->getDocumentObject('pagetitle', $parentID); $content = $docObject['pagetitle']; //output the data to wherever the snippet is being called return $content; ?>