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

    Have just installed modx and am up and running with no problems.

    I have used Joomla in the past and am having trouble getting my head around some of modx’s concepts in regards to menus. If someone could explain how I would go about the following, Im sure things will "click" for me.

    I want to know the best way to display different menu links depending on the document.
    In joomla, you would create a menu/module and then assign the module to a page.

    Lets say I have a Hompage Called "Home"
    In the template there is a top nav bar with the code:

    <div id="menucont">
    <div id="menu">
    [!Wayfinder?&startId=`0`!]
    </div>
    </div>

    Which displays links to all my documents eg

    Home
    Cats
    Dogs
    Birds
    Cat toys
    Dog toys
    Bird Feeders

    Now this is where I get confused:
    Lets say on the Home page I just want the links

    Home
    Cats
    Dogs
    Birds

    And on the Cats page I just want

    Home
    Cats Toys

    What is the best way/ options of doing this.
    I have read the paremeters of wayfinder and have figured out you can list certain documents with [!Wayfinder?&startId=`0`&includeDocs=2,3!]
    But where does that code go? chunks? template variables? A new template

    I realise this is probably bleeding obvious to most, but if you could just point me in the right direction it will help me greatly, and others that may be reading also a little confused
      • 25663 MODX Staff
      • 12,272 Posts
      You’d just update your snippet call by appending the &includeDocs param, the snippet being [!Wayfinder? ... !]

      Assuming Cat Toys was doc ID 123 (seen in the parenthesis next to the document name) and your home page was Doc ID 1, your call would look like:
      [!Wayfinder?&startId=`0`&includeDocs=`1,123`!]

      Note the backticks surrounding each parameter value—they’re not single-quotes and they should be there.

      Disclaimer: I’ve never used the &includeDocs param so not sure if it’s the right solution, but sounds like it should...
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        If you have a TV with the type of text or texarea, you can have the Wayfinder call in the TV for each document. Or, as I often do, have @INHERIT as the default value of the TV, then for each parent document I put the Wayfinder call that I want for the whole section under that parent, since all of its children will inherit its value.

        Another way to deal with this kind of situation where you want one page (Home page in this case) to always show up is to simply have the Home page link by itself, then use the CSS to make the two menus (the home page link and the rest of the Wayfinder menu) look like a single menu. Just because Wayfinder and Ditto are neat menu and listing scripts doesn’t mean that they are the only way! That’s the true MODx way: there is no "only" way laugh
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 26199
          • 2 Posts
          Thanks for your answers. Ill have more of a play with it and see how I go. Really appreciate your feedback