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

    I am using ModX Revo. I have also installed wayfinder. I want to work with a 3 level menu. Initially It should display only to level menu horizontally. After clicking a top level menu, only second level menu will appear. On clicking the second level menu, it should display only submenus under it on certain location (Please see attached file). Can you please advise how can I do this.

    What I have tried now:

    For level 1: [[Wayfinder? &startId=`0` &level=`1`]]

    For level 2: [[Wayfinder? &hideSubMenus=true ]]

    For level 3: [[Wayfinder? startId=`[[UltimateParent? &topLevel=`3`]]` &level=`1` &topLevel=`3`
    &hideSubMenus=true ]]

    But I am not sure whether &topLevel parameter is available now. Any help will be highly appreciated.

    Regards,

    Sandip
      • 32316
      • 387 Posts
      Well 1st this document is your friend: http://rtfm.modx.com/display/ADDON/Wayfinder
      and this may help http://rtfm.modx.com/display/ADDON/Wayfinder+Introductory+Examples
      and there is also a "almost complete guide to Wayfinder" google for it (I have not read this recently, but I believe it is good)

      Your call has a couple problems:
       [[Wayfinder?` &level=`1` &topLevel=`3` 
      &hideSubMenus=true ]] 
      I am not aware of a &topLevel parameter (in Wayfinder)- of course I've been known to be wrong.
      and:
      &hideSubMenus=true

      needs to be:
      hideSubMenus=`TRUE`
      or
      hideSubMenus=`1`
      to show the submenus leave out the parameter or use:
      hideSubMenus=`0` 

      note those are 'back ticks' that is " ` " and not a single quotation mark " ' "
      better use just 0 or 1 (FALSE does not evaluate to 'false' you must use 0.
      Or just not use this parameter because the default is 0 that is false. Confused yet?!?

      I think you just need a single wayfinder call with &level=`3` - this gives you a three level nested list.
      Then you probably need to set a few other parameters depending on how your css works, or maybe not.
      This might be a start for you:
       [[Wayfinder? &level=`3` 
      &hideSubMenus=`1` &selfClass=`activeItem` ]] 


      The rest is all css - same as for any 'css driven menu system'


      [ed. note: whistlemaker last edited this post 14 years, 5 months ago.]
        • 19369
        • 1,098 Posts
        Your Wayfinder calls are not visible in the forum because you haven't used the "code" button. The forum eats MODX calls for security because this forum is built with MODX.

        Quote from: sandiphw at May 03, 2012, 04:33 AM
        After clicking a top level menu, only second level menu will appear.

        1. Install this snippet, call it "treedepth":
        <?php
         
        $id = isset($id) ? $id : $modx->resource->get('id');
        $pids = $modx->getParentIds($id, 100, array('context' => 'web'));
        return count($pids);


        2. Now try with this call:
        [[treedepth:isequalto=`3`:then=``:else=`[[Wayfinder? &startId=`[[*parent]]` &level=`1`]]`]]


        Basically you are hiding the menu if you're on the third level of your website, and showing it if you are in the first or second level. If you don't understand the code let me know.

        Quote from: sandiphw at May 03, 2012, 04:33 AM

        On clicking the second level menu, it should display only submenus under it on certain location (Please see attached file). Can you please advise how can I do this.

        Install "UltimateParent" snippet from Package Management, then try this code (you'll need to change topLevel value depending on your website structure):
        [[Wayfinder? &startId=`[[UltimateParent? &topLevel=`2`]]` &level=`1`]]



        [ed. note: microcipcip last edited this post 14 years, 5 months ago.]
          • 32316
          • 387 Posts
          just messing around with a wayfinder menu and discovered my post above was wrong (I will edit it to be correct) - I had used TRUE & FALSE, in the hideSubMenu. `FALSE` does not work, you need to use `0`

          &hideSubMenus=`FALSE` does not show the submenus, one needs to use &hideSubMenus=`0`
          i.e. one needs to use `0` or `1` (even though the RTFM uses TRUE and FALSE when talking about this parameter value)

          Believe I have noted this behaviour before elsewhere

          I'm using modx 2.2.1 and wayfinder 2.3.3 about to update to modx 2.2.2 [ed. note: whistlemaker last edited this post 14 years, 5 months ago.]
            • 32316
            • 387 Posts
            Re-read the 1st post - I'm not sure what the OP is trying to achieve, I can read it more than one way, so I am not going to try to figure it out!
              • 26111
              • 17 Posts
              Thank you very much.

              Now second level of menu is working perfectly, but third level is not as desired.

              It also showing all levels from second level. I believe &topLevel parameter is not working. I have also not find it in wayfinder documentation.

              http://rtfm.modx.com/display/ADDON/Wayfinder

              Is any additional patch is required for this?
                • 22427
                • 793 Posts
                &topLevel is a parameter of the snippet UltimateParent, not of Wayfinder.

                For the third level menu try this call:
                [[!Wayfinder? &startId=`[[!UltimateParent? &topLevel=`4`]]` &hideSubMenus=`1`]]

                Perhaps you have to change the value of &topLevel, depending on your tree.
                  • 26111
                  • 17 Posts
                  [[Wayfinder? &startId=`[[UltimateParent? &topLevel=`3`]]` &level=`1`]]


                  I have tried to use this code to display only third level menu (by changing value of &topLevel) but it always shows menu from second level. What I am missing?
                    • 19369
                    • 1,098 Posts
                    Did you install "UltimateParent" Snippet?
                      • 26111
                      • 17 Posts
                      Yes, I have installed "UltimateParent" through package manager. Pl see attached screen-shot. [ed. note: sandiphw last edited this post 14 years, 4 months ago.]