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

    I have a simple question: I have a split navigation: 1st level on top of the page, the rest using ultimateparent on the right side. Now I want a title for the navigation on the right, displaying the current "category", wich in fact is the name of the active 1st level item. Would be nice to implement it into the ultimateparent template but its no problem if I have to make an additional call using wayfinder.

    Who can I do this?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      For the "title" of a submenu, I always use a TV with the default set to @INHERIT, then for each "parent" document set it to the section title I want. That way all of its children inherit the same title.
        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
        • 12656
        • 13 Posts
        but for that I would have to make separate templates (or TVs) for each section. Am I right?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          No. Make the TV’s default be @INHERIT. Then on the parent page for each section, edit the TV and put in what you want the title to be for that whole section. All of that page’s children will inherit that value for the title. Do the same for each "parent" page.
            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
            • 12656
            • 13 Posts
            ah okay now I get it! thats so easy, thanks a lot!
              • 8280
              • 9 Posts
              Hi Susan,

              thanks, I was trying to set up a similar scheme to ’idiotic.marc’. The @INHERIT method you suggested was very useful and easy to implement.

              I’d like to go a small step further and make the ’current category’ a link, so when users browse child pages they can easily get make to the directory index.

              So far I have successfully constructed a peer navigation using Wayfinder and a TV call like this:

              <div class="peerNavigation">
              	<h2><a href="[[UltimateParent]]" title="Return to this section's index page.">[*dirIndexTV*]</a></h2>
              	[[Wayfinder?startId=`[*parent*]` &level=`1`]]
              </div>
              


              As you can see, I’ve used UltimateParent to generate the link for the directory index. While this works, it only gives me the numeric ID for the page and not its alias. Could anybody suggest how I might retrieve the alias (and I guess the friendly URL suffix too) from MODx to generate a meaningful URL?

              I’d also like to find a way to craft a conditional statement, so I can turn off the link to the directory index if the user is already on that page.

              Thanks for any pointers any might be able to provide.
                • 7455
                • 2,204 Posts
                Quote from: dwalters at Jul 18, 2007, 11:07 PM



                As you can see, I’ve used UltimateParent to generate the link for the directory index. While this works, it only gives me the numeric ID for the page and not its alias. Could anybody suggest how I might retrieve the alias (and I guess the friendly URL suffix too) from MODx to generate a meaningful URL?



                <a href="[~[!UltimateParent!]~]"...

                will do the trick
                  follow me on twitter: @dimmy01
                  • 6726
                  • 7,075 Posts
                  Never tried to use it that way, thanks for the tip, quite powerful thanks Dimmy !
                    .: COO - Commerce Guys - Community Driven Innovation :.


                    MODx est l&#39;outil id
                    • 8280
                    • 9 Posts
                    Much appreciated. Thanks for your help, Dimmy.

                    - DW
                      • 8280
                      • 9 Posts
                      Hi again,

                      thanks to Dimmy’s suggestion I got the code below working:

                      <div class="peerNavigation">
                              <h2><a href="[~[!UltimateParent!]~]" title="Return to this section's index page.">[*dirIndexTV*]</a></h2>
                      	[[Wayfinder?startId=`[*parent*]` &level=`1`]]
                      </div>
                      


                      What I have found, however, was that my UltimateParent call was generating a link to the index one directory higher than I required. I figured out I can do the following call to limit the UltimateParent call to the desired directory level. Only problem is, it again displays the MODx page ID , rather than the page title. Could somebody please suggest the correct syntax for this call. Perhaps I need to next two snippet calls?

                      [[UltimateParent? &topLevel=`2`]]
                      


                      Many thanks, DW.