We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21092
    • 54 Posts
    Hi,
    I am back with some slight issues with my wayfinder menu. On my website www.katskinner.com I use wayfinder to create a "categories" section on the sidebar, generating the links from container documents.
    It works perfectly until a user browses to the actual article within the containers, at which stage the wayfinder does not display any content (or in a few cases displays the list of articles themselves).
    I tried using the levels option, however cannot seem to get it to work. The code I am using is:
    [!Wayfinder?startId=`[*id*]` &outerTpl=`mh.OuterTpl` &rowTpl=`mh.RowTpl` &innerRowTpl=`mh.InnerRowTpl` &firstClass=`first` &hereClass=`` &level=`1` !]


    I would really not like to use the levels if possible (correct me if I am wrong) as its generating the code for every section of my website and each section varies in the number of parent and child documents (as containers and articles), thus by using levels it would not necessarily show up correctly under different sections. Nor do I wish to create a code for each different section if possible.
    What I am after is a script that will show all the containers only, and when at the bottom child of the tree (i.e. the actual articles), it shows the containers above it (i.e. the parent and any other containers at that level under that section).

    Can anyone please help provide such a code, that will work across all sections of my site.

    Thanks in advance,
    Kathleen
      Visit www.katskinner.com for all your expert novel writing tips, tutorials and more.
      • 22303 MODX Staff
      • 10,725 Posts
      Instead of using [*id*] as your startId, try making use of the [[UltimateParent]] snippet, or put your menu calls in a TV with a default value of @INHERIT; then you can simply change the startId for each container/section and it will be inherited in the children.
        • 21092
        • 54 Posts
        OpenGeek - thanks for the suggestion.

        I’m not familiar with the UltimateParent snippet yet... When I did try, I managed to get it to generate the actual id of the top level (which I assume is the snippet working correctly). Could someone help manipulate the code to show the Container Name directly above and not the "ultimate parent" id (i.e. the parent id of the article being viewed)?

        I’m not sure if this will have an issue with the top level of my site tree where I have my home page, and all other main sections on the same level (I want my home page to display all main sections).

        I am not also familiar with the @INHERIT value.

        I am looking these up as I go, but it always much easier and time consuming to dissect a working model.

        Thanks in advance,
        Kathleen
          Visit www.katskinner.com for all your expert novel writing tips, tutorials and more.
          • 21092
          • 54 Posts
          I managed to get it to work, sort of. I just need some help with the last bit...
          My tree currently looks like this:
          - Home
          - Writing Lessons (ultimate parent)
          - Story Structure (container)
          - String of Pearls (article)
          - Linear Structure (article)

          With the code
          [!Wayfinder? &startId=`[[UltimateParent]]` &level=`1`!]

          I am able to display the stuff correctly on the pages Writing Lessons, and all articles.

          However the code:
          [!Wayfinder?startId=`[*id*]` &outerTpl=`mh.OuterTpl` &rowTpl=`mh.RowTpl` &innerRowTpl=`mh.InnerRowTpl` &firstClass=`first` &hereClass=`` &level=`1` !]

          I am able to display the contents correctly on the Story Structure and Writing Lessons page.

          I’d rather not use the ultimate parent as a TV for the article pages, so is there a way to make it display all properly.
            Visit www.katskinner.com for all your expert novel writing tips, tutorials and more.
            • 22303 MODX Staff
            • 10,725 Posts
            All you need to do is create a Template Variable for the template Writing Lessons with a default value of:
            @INHERIT


            Then edit the Writing Lessons page and insert your Wayfinder call using the actual id of Writing Lessons into that Template Variable value, e.g. if it’s id = 10:
            [[Wayfinder? &startId=`10`]]


            This menu will then be displayed on the Writing Lessons page, and inherited by all of the child pages of Writing Lessons.

            Now, if you need different calls at various levels this may not be the best solution, but if the menu remains the same at all depths underneath the top-level page, this is the more efficient solution IMO.

            I do not think you need the &level parameter, unless I’m misunderstanding the intended look of your menus (i.e. if they are supposed to change at different levels).
              • 21092
              • 54 Posts
              OpenGeek - thanks for all the help, it was very much appreciated.
              I ended up just going with the alternative option. I had wanted the menu to change under each level. What I ended up doing was using the code
              [!Wayfinder?startId=`[*id*]` &outerTpl=`mh.OuterTpl` &rowTpl=`mh.RowTpl` &innerRowTpl=`mh.InnerRowTpl` &firstClass=`first` &hereClass=`` &level=`1` !]

              for all containers, and the code
              [!Wayfinder? &startId=`[[UltimateParent]]` &level=`1`!]

              for all articles.
              I basically created two chunk and two templates (a template for containers and a template for articles).
              It wasn’t what I originally wanted, but hey it works.

              Thanks again for your help.
                Visit www.katskinner.com for all your expert novel writing tips, tutorials and more.

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