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

    Another query, and thanks for being such a helpful forum. I’m creating a site here: http://www.medicosconscientes.net/index.php?id=11

    In the right hand box, I’d like to have a menu of all of the pages that sit at the same level and below the current document.

    I’d like to use Wayfinder, and I can see that I could do this by setting &startId= to the current document ID, but that means creating far too many templates (one for each section). Is there i way I can use &startId= to look for the ID of the current document and use that as the starting point?

    With Ultimate Parent, as far as I can tell, I also have to specify a starting ID, rather than having it flexible depending on where the page is.

    thanks!

    Rachel
      • 20288
      • 132 Posts
      I’m sure it’s not the most ideal, and there might be a more elegant solution, but you could:

      - Create different chunks for each page, that have the same Wayfinder call but different &startID
      - Create a "subnav" Template Variable that every page has access to
      - Drop that page’s specific chunk into the TV

      Again - it’s a bit of work and it won’t be a viable solution if there are lots of pages, but for a small static site, it might be OK.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Or use a TV with @INHERIT as the default, and set the TV to the desired ID on all parent pages; their children will inherit the startId.
          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
          • 36575
          • 104 Posts
          Susan, thanks for responding. Could you point me in the direction of an example of the TV solution? I’m afraid I have no idea how to implement it.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Create a TV (simple text type) with its default value @INHERIT.

            Now on the parent documents, set the TV to the desired doc ID for that section.

            Use the TV tags as the value of startId parameter in your Wayfinder snippet.
              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
              • 36575
              • 104 Posts
              Hi,

              Thanks so much for helping and sorry I am not following along very well. Beginner programmer, beginner with modx.
              This is what i’ve done:

              created a tv called id

              the tv has an input type of text, default value @INHERIT, and output type default

              in the wayfinder call, this is my code:

              [[Wayfinder? &startId=`[[*id]]` &level=`1`]]

              Then I have gone into the page, and added the id into the TV, in this case, 14.

              I’ve now lost the main menu at the top, which is using the wayfinder & ultimate parent, and also the side menu is not showing up.

              http://www.medicosconscientes.net/index.php?id=31

              The code for the menu at the top that I have lost is:

              [[Wayfinder? &startId=`[[UltimateParent]]` &hereClass=`current` &level=`2`]]

              thanks so much Susan