We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36805
    • 354 Posts
    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);
    
      • 36805
      • 354 Posts
      It turns out I don’t need to make the modification since the BreadCrumbs snippet offers the possibility of setting a parameter called $homeCrumbTitle to use something else as title (like menu title in my case)

      http://modxcms.com/forums/index.php/topic,3044.0.html