We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13476
    • 8 Posts
    Hi all,

    I am really really happy I found MODx! - have been looking for a while for a decent CMS with terminology you can understand etc etc - so far I’m really liking it!

    My first problem is doing a page trail - I don’t want the root to appear - and I don’t want it to show up on a page that is a child of the root.

    So I did this:

    if ($modx->documentObject['id'] !== $modx->config['site_start'] || $modx->documentObject['parent'] !== $modx->config['site_start']) {
      return $modx->runSnippet('PageTrail');
    }
    



    But it doesn’t seem to want to work...

    http://club.triumph.org.uk/comps_cms4/



    Many thanks,

    James
      • 7923
      • 4,213 Posts
      I believe that the BreadCrumbs snippet has options to achieve this, but here’s some code:

      if ($modx->documentObject['parent'] != 0) {
        return $modx->runSnippet('PageTrail');
      }
      


      That runs the snippet if document is not on site root. You can add parameters to the PageTrail snippet too if you need, by using:

      $modx->runSnippet(’PageTrail’, array("parameter1" => "value", "parameter2" => "value"));


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 13476
        • 8 Posts
        Hmmm - that doesn’t seem to work sad

        Don’t know why....

        if ($modx->documentObject['parent'] !== 0) {
          return $modx->runSnippet('PageTrail');
        }
        

          • 7923
          • 4,213 Posts
          why have you added extra = to the conditional?


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 13476
            • 8 Posts
            Oooops!

            My bad...!

            Works now smiley

            Now all I need to do is get my main menu to have a bit more logic so that the sub menu works properly and I’m sorted smiley