We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 35721
    • 19 Posts
    Please help me...

    I have 2 menus on my page. And have called Wayfinder 2 times, see code below. I want resource id1 to be listed in the first menu and everything below resource id2 to be called into the 2nd menu. Nothing shows up on the page at all. If I change the id to 0 that is the only way I can see the menus, though it doesn’t work how I want then. I had also thought to put the resources into folders to sort them for the 2 menus though can’t see how to create folders, is it possible? Any help would be most gratefully received.

    <div id="nav" role="navigation">

    <h2>Navigation</h2>

    [[!Wayfinder?
    &startId=`1`
    &outerTpl=`navigation_ul_first`
    &rowTpl=`navigation_li`
    &hereClass=`current`
    &firstClass=``
    &lastClass =`` ]]

    [[!Wayfinder?
    &startId=`2`
    &outerTpl=`navigation_ul_second`
    &rowTpl=`navigation_li`
    &hereClass=`current`
    &firstClass=``
    &lastClass =`` ]]

    </div>
      • 8609
      • 607 Posts
      You’re using startId incorrectly. From the docs, startId is "The starting point (document ID) for the menu to list documents from. Specify 0 to start from the site root. " The reason you get nothing when you use `1` or `2`as your startId is because Wayfinder is then looking to list the children of those resources.

      One way to accomplish what you want is to use &excludeDocs

      <div id="nav" role="navigation">
                     
         <h2>Navigation</h2>
            
         [[!Wayfinder?
                                &startId=`0`
                                &excludeDocs=`2,3,4,5` (and so on)
                                &outerTpl=`navigation_ul_first`
                                &rowTpl=`navigation_li`
                                &hereClass=`current`
                                &firstClass=``
                                &lastClass =`` ]]
      
         [[!Wayfinder?
                                &startId=`0`
                                &excludeDocs=`1`
                                &outerTpl=`navigation_ul_second`
                                &rowTpl=`navigation_li`
                                &hereClass=`current`
                                &firstClass=``
                                &lastClass =`` ]]
            
      </div>


      The other option as you say is to use folders. So create two empty resources, hide them from menus. Make the first resource the parent of doc 1 and the other resource the parent of resources with id 2 onwards. If your two new resources have ids say 10 and 11, you can then use your Wayfinder calls as you have them in your example and just change your startId to 10 for the first 1 and 11 for the other.


      Some reading: http://rtfm.modx.com/display/ADDON/Wayfinder, http://codingpad.maryspad.com/2011/02/21/modx-revolution-for-complete-beginners-part-8-using-wayfinder-to-create-menus/
      HTH
        • 35721
        • 19 Posts
        This is BRILLIANT! Thanks so much einsteinsboi, been looking at this for hours!

        Just perfect. Thank you.