We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51756
    • 6 Posts
    I'm trying to get a section menu using Wayfinder.

    If I do this:
    [[Wayfinder? &level=`1` &startId=`[[*parent]]` &displayStart=`true` &startItemTpl=`LinkedListItemTpl`]]

    It doesn't link the top-level page of the section in the list. Plus if you're on the top-level page, it shows the other top-level nav pages. So if I have a top-level page called "Top Level A" and then some children called "Sub Page", the menu should look like on all pages within the Top Level A section (including Top Level A):

    Top Level A
    Sub Page A
    Sub Page B

    If I have a top-level page called "Top Level B" and then some children called "Sub Page", the menu should look like on all pages within the Top Level B section (including Top Level B):

    Top Level B
    Sub Page A
    Sub Page B

    However, using the above code, when I'm on Top Level A or B, it looks like:

    Top Level A
    Top Level B

    In other words, I need a section menu with the Top Level pages acting like they are part of the same section.

    Can anyone help?
    • Looks like you need to use the &displayStart property, then adjust the outerTpl and startItemTpl to include the start item's link in with the rest of the menu. These will have the startItemTpl (which is the parent resource) start the UL element and insert its own LI element and link, then continue processing. The outerTpl will generate the rest of the menu then close the UL element.

      The outerTpl
      [[+wf.wrapper]]
      </ul>


      The startItemTpl
      <ul>
      <li [[+wf.classes]]><a href="[+wf.link+]">[+wf.linktext+]</a></li>
      [[+wf.wrapper]]
        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
        • 51756
        • 6 Posts
        Hi - I'm not sure what to do with that code. I'm very new to Wayfinder (as in only a couple of hours).
        • In your Wayfinder snippet, add the &displayStart=`1` property and the &startItemTpl=`chunkname` and &outerTpl=`chunkname`.

          The outerTpl chunk is as above, and the startItemTpl chunk is as above.

          The outerTpl sets up how the outermost UL tags will be output, and the startItemTpl chunk sets up how the start (parent) item will be output. Wayfinder generates the startItemTpl part first, then the outerTpl part.
            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
            • 51756
            • 6 Posts
            That generates the menu. However, it doesn't show the current page. So, it shows:

            [+wf.linktext+]
            Sub Page A
            Sub Page B

            with wf.linktext being where the Top Level page should be. And when I'm on a top level page, it shows

            Top Level A
            Top Level B
            Top Level C

            Rather than

            Top Level A
            Sub Page A
            Sub Page B