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

    I have a site that requires a sub menu. So the layout is as follows:



    • Homepage

    • - Sub page 1
    • - Sub page 2

    • About

    • - Sub page 3
    • - Sub page 4


    The amin navigation runs along the top of the site, and no problem there, wayfinder to the rescue. The trouble im having is when click on home, I want a side navigation to appear, showing just 'sub page 1' & 'sub page 2'. I have managed to get this to work by using getresources and the following code:

    [[!getResources? &parents=`[[*id]]` &tpl=`submenu` &showHidden=`0` &sortBy=`menuindex`]]


    This works to a point... When i then click 'sub page 1' I still want to be able to see both 'sub page 1' & 'sub page 2'.

    Any help on this welcome... Also as a side point the '&sortBy=`menuindex`' isn't working...

    This question has been answered by microcipcip. See the first response.

    [ed. note: jimboroberts last edited this post 14 years, 9 months ago.]
      Linux, PHP 5.2, MySQL 5.0, Revo 2.2.0-pl2
      • 22427
      • 793 Posts
      You can create the side navigation using Wayfinder (instead of getResources) - if Sub page 1 and Sub page 2 are indeed child resources of Homepage (in the tree, not just in the layout).
      Then the Wayfinder call should be
      [[!Wayfinder? &startId=`0` &level=`1`]]
      (assuming that the id of the Homepage is 0).
        • 14167
        • 55 Posts
        Hi Ottogal,

        the sub pages are children in the tree. I don't however want to see the other titles of the main pages, only the sub page titles.

        Does that makes sense?
          Linux, PHP 5.2, MySQL 5.0, Revo 2.2.0-pl2
        • discuss.answer
          • 19369
          • 1,098 Posts
          Install "UltimateParent" Snippet from "Package Management" and try this:

          [[Wayfinder? &startId=`[[UltimateParent? &topLevel=`1`]]` &level=`2` &sortBy=`menuindex` ]]
            • 19369
            • 1,098 Posts
            I've replied but the code is above, it must be a forum issue.
              • 22427
              • 793 Posts
              By the parameter &startId you determine the resource of which you want to show the children.
              Assuming in your tree you have the following IDs:
               web
               --  Homepage	(1)
              
                  - Sub page 1	(3)
                  - Sub page 2	(4)
              
               --  About	(2)
              
                  - Sub page 3	(5)
                  - Sub page 4	(6)
              
              Then using &startId=`1` for the side navigation you will get just the children (3) and (4).

              (For the main menu you need &startId=`0` - 0 is refering to the root of the tree, the context "web"; and you need &level=`1` to suppress the display of the Sub pages here.)
                • 14167
                • 55 Posts
                Thanks Both, Microcipcip, I have marked your post as solved, think this is why it appears below the question.
                  Linux, PHP 5.2, MySQL 5.0, Revo 2.2.0-pl2