Hi,
I want to modify the PageTrail snippet to make it use the menutitle’s instead of the pagetitle’s. Below you can see how i modified the snippet.
I simply replaced the array key ’pagetitle’ with ’menutitle’. It works for the current document menutitle but for the recursive retrieval of the menutitle’s of the parent documents. It seems that somehow $etomite->getPageInfo($pid) doesnt return an array which includes it. What can i do to achieve the desired effect?
/*
* PageTrail - updated to work with MODx
*
* Properties:
*
* &sep - page trail separator
* &style - inline style
* &class - style sheet name
*/
$sep = isset($sep) ? $sep :" » ";
$style = isset($style) ? " style=\"$style\" " :"";
$class = isset($class) ? " class=\"$class\" " :"";
// end config
$ptarr = array();
$pid = $etomite->documentObject['parent'];
$ptarr[] = "<a $class $style href='[~".$etomite->documentObject['id']."~]'>".$etomite->documentObject['menutitle']."</a>";
while ($parent=$etomite->getPageInfo($pid)) {
$ptarr[] = "<a $class $style href='[~".$parent['id']."~]'>".$parent['menutitle']."</a>";
$pid = $parent['parent'];
}
$ptarr = array_reverse($ptarr);
return join($ptarr, $sep);