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

    I’m new to modx so please be patient with me..

    Basically i have added a top menu using wayfinder and it just displays top level pages (home, about us, contact us etc).

    On each page i also have a submenu running down the left of the page that i want to display each pages sub pages. For example say i have a services page and i click on services from the top menu navigation, i then need all the sub pages for services to be displayed in the sub menu. Sub items may be calculation service, general services etc.

    I hope this makes sense?

    any help would be appreciated

    thanks laugh
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      For the side menu, set a couple of extra parameters in the snippet call:
      [[Wayfinder? &startId=`xx` &level=`2` &hideSubMenus=`1`]]

      Now the side menu will only show the submenus when you’ve clicked on one of the side menu top-level items.

        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
        • 27023
        • 36 Posts
        Are right i see where your coming from there..

        Just need to complicate a little.

        If i have a subpage under one of the submenu pages (3 page levels) how would i go about that?

        So for instance my top navigation displays (HOME | SERVICES | CONTACT)

        My submenu for Home page : displays nothing as it has no subpages

        My submenu for Services page : displays (GENERAL | DOMESTIC | COMMERCIAL) but then under each one of these i have 3 subpages.

        ????

        thanks for the quick reply by the way!!
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          So the side menu will need to be a multi-level flyout menu. There’s a ton of examples of how to do this in just css, or with javascript. Since Wayfinder by default puts out a simple nested unordered list, the css versions are quite simple. The hideSubMenus parameter would still be useful when in the top level, though; the second and third levels would not appear at all until the visitor moved into the second level.

          http://www.muddydogpaws.com/development/wayfinder/examples/example-6.html
            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
            • 27023
            • 36 Posts
            Thanks but i managed to create a multi level menu using css but will be using jquery for an accordion effect once i’ve mastered wayfinder grin

            Basically using the parameters you quoted this displays the same submenu on all the pages, however i need it to show just the submenus relevant to that top navigation.

            Sorry if im confusing you!!

            I understand that they wont see the other levels until they click on the sub menu page.

            thanks
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Use this:
              [!Wayfinder? &startId=`[[UltimateParent]]`!]

              Notice that the Wayfinder snippet is called uncached [!...!] while the inner UltimateParent snippet is called normally [[...]]
                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
                • 16183
                • 1,390 Posts
                Quote from: shickson at Aug 24, 2009, 10:22 AM

                Thanks but i managed to create a multi level menu using css but will be using jquery for an accordion effect once i’ve mastered wayfinder grin

                Basically using the parameters you quoted this displays the same submenu on all the pages, however i need it to show just the submenus relevant to that top navigation.

                Sorry if im confusing you!!

                I understand that they wont see the other levels until they click on the sub menu page.

                thanks

                EDIT: Aaah, Susan beat me to it...anyway, I’ll let this post be smiley

                Actually I believe what you need is Susan’s own snippet called UltimateParent. It is probably already installed for you if you installed MODx Evo with the packaged elements (snippets, chunks, etc). If not, grab a copy from the extras section on modxcms.com

                In your side-menu, use code similar to this:

                [!Wayfinder? &startId=`[[UltimateParent]]` &outerTpl=`menuContainer` &rowTpl=`menuRows`
                &level=`3`!]


                The above code will make sure that the side-menu will only show the children of the currently active main menu item. For a document such as "Home", since it has no children, nothing will be shown in the side-menu.

                Note that: in the above code, I have included outerTpl and rowTpl for illustration purposes only. The other parameters, startId and level are necessary for the type of menu you want. Note also that Wayfinder is called uncached [!!] whilst UltimateParent is called cached [[]].

                Search UltimateParent for more examples. If you have the time, you can also grab the e-book in my sig and have a read. See page 119 for this particular menu type.

                Hope this helps.

                cheers/k

                  • 27023
                  • 36 Posts
                  ahhhh! that makes sense... thanks for that! I’ve seen that snippet and forgot all about it!

                  cheers guys and ladies, and thanks for the amazing quick responses. I’m a member of many forums but never have i experienced customer service like it.. cheers
                    • 4675
                    • 38 Posts
                    The Ultimate parent snippet works really well. My next question is how do you get the parent to also show up on the sub menu, along with its child, even if the parent is already listed in the main menu?

                    For example, I have here: http://laurielandry.com/index.php?id=2

                    Where you’ll see the About Me page. For usability purposes, I’d like to be able to add the "About Me" link on the sub menu, since if you click on the "CV" link, there’s no link taking you back from the CV page unless you click on the main menu. It works fine, but for usability, it’s good to include the parent link...

                    thanks in advance.

                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      If you are referring to the menu (single item) on the left of the page, the Wayfinder call should have &displayStart=`1`. Then you’ll probably want to use a &startItemTpl chunk to format that parent item, as by default it puts it in <h2> tags.
                        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