We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21163
    • 18 Posts
    When you have wayfinder build a complete menu tree, the submenus are placed inside the items that contain the lower levels, via the [*wf.wrapper*] tag, I think. However, I would like to have the submenus after all of the corresponding level, because I want the levels displayed below each other, highlighting the menu items on the way up that are the current items on each level.

    The behaviour would be just like the menu here:
    http://www.stud.uni-goettingen.de/~s307473/sophia

    In fact, I just want to port that page into MODx, and the last hurdle is just getting the menu right.

    Is it possibly to have that with a single wayfinder call? If not, how can it be done?

    Thanks in advance,
    René
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You could do it in CSS, have the usual "ul li ul" position: absolute, and simply place the top where you want it below the bottom of your main menu.

      You could do it with dual Wayfinder calls, the first one with a startId of 0 to generate the main (top) menu, and the second one using the ultimateParent snippet call as the startId, thus generating a secondary menu appropriate for whichever section the user has navigated to.
        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
        • 21163
        • 18 Posts
        Thanks!

        The CSS solution is not for me, I fear, because the vertical position of the second, much more the third submenu will vary, depending on the height of the above menus. Also, if the user changed the size of the font, the menus wouldn’t adjust properly, and the menu items would hit the top of the below menus at some point.

        So I am thinking about the dual, or triple Wayfinder call way:
        I would have two fixed, unconditional calls, as all the pages in the first level have children. That part of the story is no problem.

        What I can’t figure out yet is how to tell on what pages the third Wayfinder call should be done. Obviously, two conditions must be fulfilled:
        1. The current page must be inside the second level.
        2. The current page must have children in the menu tree, otherwise the third menu will be empty.

        How can these conditions be formulated in MODx, to be used in an if-construct? Hmm, if I knew these, I could even use this strategy to have some more levels! laugh

        Thanks again!
        René
          • 7231
          • 4,205 Posts
          I guess you could use the getparent and getDocumentChildren api functions to brew something up.
          http://modxcms.com/api-quick-reference.html

          I would peak into other snippets that deal with levels, like ultimateParent or Wayfinder and see how they determine the current level.
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don't know what it is.
            Do you, Mr. Jones? - [bob dylan]