We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8350
    • 6 Posts
    Hi, I have some problem and needs some helps.

    My web structure is like
    /[root]
    Home
    About Us
    Profile
    Protfolio
    Contact Us
    News
    Public News
    Internal news
    Archive

    The web layout:
    [ Header (Logo, Banner) ]
    [ Top Menu (Home, About Us Contact Us, News) ]
    [ Left Menu ][ Content ]
    [ Footer ]

    If the document child exist (like About Us or News), then Left Menu will appears.
    The problem is, if I click the About Us, the menu Profile and Portfolio appears,
    but if I click Profile or Portfolio , the left menu disappear sad
    The problem can be solved with create many chunks/template that point to document parent,
    but I think that can be a pain (and make human error chance bigger) if document is many.
    So my question is, how to create left menu always appears (dynamically), if I click the child,
    without creating many chunks /template that point to current parent document id (not current document id)

    Sorry, if there is already thread this, can I please have the link?
    Thank you very much.
      • 36592
      • 970 Posts
      I think UltimateParent snippet, which is included in your default MODx install, will help you.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        So you would use
        [!Wayfinder? &startId=`[[UltimateParent]]` ... !]

        Note the Wayfinder snippet is called uncached, while the inner UltimateParent snippet is cached. This causes MODx to skip processing the Wayfinder snippet on the first pass, while processing the UltimateParent snippet. Then on the second pass, it will process the Wayfinder snippet, now with the actual returned value of the UltimateParent snippet in the startId parameter.

        Another way to do this would be to make a TV with a default value of @INHERIT. In the parent documents, edit this TV to have the Wayfinder call with a startId of that parent document. This way all of its children will "inherit" that Wayfinder call. Don’t use [*id*] as the startId, since this means "this document’s ID", and when inherited will still mean "this document’s ID", which when looking at a child page will mean that child document’s ID!
          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
          • 8350
          • 6 Posts
          Thank you very much for the answer, that really helpful.
          I already try it and works, so my problem solved smiley
          Thanks again.

          This discussion is closed to further replies. Keep calm and carry on.