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

    I have to build a wayfinder menu which only outputs documents from the container of the given document - ie:
    Red container - list of all red container documents
    Green container - list of all green container documents

    I can’t specify the &startID paramater as the wayfinder call is in a template which is used for multiple documents in various different containers.

    Should i use this sort of thing?:
    [[!Wayfinder? &startId=`[*parent*]` &level=`1`!]]

    Found this in a forum search and don’t know about the [*parent*] tv bit in wayfinder.

    Thanks in advance
    (btw i have to ask before trying it out for various reasons wink)
      • 25519
      • 265 Posts
      Ha! I’d answered my own question - it’s:
      [[Wayfinder? &startId=`[*parent*]`]]
      rolleyes
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Keep in mind that if your "red" container has multiple levels this won’t work; "grandchildren" will be using their parent, a child of "red".

        Usually for this kind of thing I use a TV with @INHERIT as the default value, then in the parent resource (the one I want the menu built from) I edit the TV with its 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
          • 25519
          • 265 Posts
          Thanks for that - I did see an earlier reply you wrote about this subject:
          http://modxcms.com/forums/index.php?topic=9887.0;wap2

          This does sound more suitable as working with one level is restrictive. However I tried it but didn’t get it to work, was a bit wooly about this bit:
          then in the parent resource (the one I want the menu built from) I edit the TV with its ID.

          Could you explain that a little more please?

          Thanks
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            You have a structure like this

            1
            1.1
            1.2
            1.3
            2
            2.1
            2.2
            2.3
            2.3.1
            2.3.2
            3


            You want the menu of the 1. items to use 1 as its parent, the menu for 2. items (including 2.3 items) to use 2 as the parent. If you just use [*parent*], then 2.3.1 will use 2.3 as the startId, when you want it to use 2.

            If you create a TV with @INHERIT, then for 1, 2 and 3 you edit it (1 for 1, 2 for 2, etc), then each one’s children will inherit the same value. So all of 1’s children will use 1 and all of 2’s children and grandchildren will use 2. When you use @INHERIT, you don’t edit the TV for any of the child resources, they inherit the value you set in their parent resource.

            Possibly even better, if the parent resources in question are top-level resources, you can use the UltimateParent snippet. It returns the ID of the top-level parent. Just remember to alternate the snippet tags from uncached to cached (for Evo) [!Wayfinder? &startId=`[[UltimateParent]]`!]; you don’t have to worry about that for Revo.
              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
              • 25519
              • 265 Posts
              Brilliant, many thanks
              Sorry to ask again but my sticking point is I don’t know what you mean by editing the TV - edit in what way please?

              Here’s the TV info:
              Name: startTV
              Input type: Text
              Default Val: @INHERIT

              The TV is applied to the required Template which will be applied across different containers.

              This is my snippet call - [[Wayfinder? &startId=`[*startTV*]` ... ]] - but it got no joy
              fyi, I’m using PHx in the site and have tried both cached and uncached.

              Thanks