We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 369
    • 4 Posts
    This has really got me stumped...

    I made a template with a horizontal menu using a snippet. I also want some pages to have a vertical menu. A quick search of the forum lead me to the UltimateParent snippet, sounded like exactly what I wanted.

    If I put this code in my template, it works exactly the way I want (on page ID 39)
    [[DropMenu? &maxLevel=`1` &startDoc=`39` &hereClass=`active_sub`]]

    39 is the page ID of the first page that should have the vertical menu... I don’t want to hard code the Page ID in the template, so I tried using the UltimateParent snippet. If I visit the page I’m working on, and have this code in the template:
    [[UltimateParent]]
    The snippet is replaced by the text 39... just the way it should.

    So I thought this do what I needed:
    [[DropMenu? &maxLevel=`1` &startDoc=`[UltimateParent]` &hereClass=`active_sub`]]
    But it doesn’t. Its acting as if the [UltimateParent] snippet is returning zero. But if I just put the [[UltimateParent]] code it returns 39.

    Any ideas?
      • 11975
      • 2,542 Posts
      Hi,

      change your snippet call as follows

      [!DropMenu? &maxLevel=`1` &startDoc=`[[UltimateParent]]` &hereClass=`active_sub` !]

      :-)

        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 369
        • 4 Posts
        Thanks, that did it!

        Any suggested reading I can do? I didn’t see references to [! in the Developers Guide... and I’m not exactly sure what its doing or why [[ didn’t work.
          • 25663 MODX Staff
          • 12,272 Posts
          Because you can’t have nested snippet calls with snippets with parameters, without the outside one being uncached... the way the parser currently works.
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me