We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22586
    • 74 Posts
    Hi all, I am working on a dynamic submenu with modx, and it’s going well. Wayfinder is a great tool.

    But now I have a wayfinder chunk where I only want to get a childfolder to output its links. Like this :

    [MyMainMenu]
    |
    |---MySubMenu
    | |
    | ----lots of links folder 1
    | |
    | ----lots of links folder 2
    |
    |---MySecondSub
    |
    -----lots of links folder 1
    |
    -----lots of links folder 2



    So I have wayfinder that outputs MySubmenu, MySecondSub and all links under it, but I *only* want to output the links that are under the folder with the name "lots of links folder 1"

    I am currently using a second wayfinder call that works under each mainmenu link, but I fail to get either the ID or the name of "lots of links folder 1"

    Thank you for any help, much appreciated!
      • 27376
      • 576 Posts
      Have you tried using the UltimateParent snippet for the Wayfinder startId?

      [tt][[UltimateParent? &topLevel=`2`]][/tt]
        • 22586
        • 74 Posts
        Thank you for replying, something weird I noticed, if I do this :

        [!Wayfinder? &startId=`[[UltimateParent]]` !]

        I get to see the code in the menu. From the examples I’ve seen this is the way to call UltimateParent to get the right order of execution. The other way around with the brackets [[Wayfinder blabla [!UltimateParent!] ]] does nothing.

        I am keeping investigating this, if I have more info or a better example, I’ll post. Any hints & help always welcome in the meantime smiley

          • 27376
          • 576 Posts
          Cached snippets ("[tt][[snippet]][/tt]") are processed before un-cached snippets.

          The MODx 0.9.6.x parser does not allow nested snippet calls, so the un-cached to cached snippet method used in Wayfinder could better be considered a workaround to the limitations of the current parser.

          The MODx 0.9.7 parser will allow for nested tags as described above.

          Look here for another example: http://modxcms.com/forums/index.php/topic,15931.0.html
            • 22586
            • 74 Posts
            I solved it, but not with wayfinder, as the cure seemed trickier than the ail. So I grabbed my PHP bag and wrote a custom snippet (my first!! yay)

            It involved using the modx API function getDocumentChildren , and then using while and the PHP list function to traverse down the hierarchy. Everytime it comes accross a folder called "linkfolder" it publishes all links in that folder as a child of the parent topic it is part of.

            Its not beautiful code, but it works smiley

            Thank you for helping sirlancelot! When 0.9.7 comes around I shall check again if wayfinder can do the same.