We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4675
    • 38 Posts
    that works, sort of.

    This is my subnavigation call:
    [!Wayfinder? &startId=`[[UltimateParent]]` &displayStart=`1` &startItemTpl=`submenustart` &level=`1`!]

    and &displayStart=`1` works, as you advised.

    My &startItemTpl chunk has been created and named submenustart.

    <ul><li>[+wf.linktext+]</li></ul>[+wf.wrapper+]

    Looks good. How do I make this a link too?
      • 16183
      • 1,390 Posts
      Quote from: cartierbailey at Sep 02, 2009, 10:00 PM

      ....My &startItemTpl chunk has been created and named submenustart.

      <ul><li>[+wf.linktext+]</li></ul>[+wf.wrapper+]

      Looks good. How do I make this a link too?

      Hi,

      This should do it:

      <ul><li><a href="[+wf.link+]">[+wf.linktext+]</a></li></ul>[+wf.wrapper+]


      You can add other placeholders within the opening <a> tag if you wish (such as title ="[+wf.title+]". See the developer’s site for some examples. If you don’t mind reading a long guide, feel free to grab the e-book in my sig too.

      cheers/k
        • 4675
        • 38 Posts
        Thank you very much! I will have to print off the ebook, as I can’t seem to read such a great documentation online.

        Consider this 99% solved. the 1% unsolved is how to apply the active status to just this page if this page is active. For example, if I’m on the About Me page, I want this subnavigation link to be active. If I move on to the Resume page, then the About Me page shoulnd’t be an active link as well as the Resume page.

        I have the chunk like this: <ul><li class="active"><a href="[+wf.link+]">[+wf.linktext+]</a></li></ul>[+wf.wrapper+]

        which of course, makes this page a permanent "active" page regardless of where else you are on. There must be a way to change it to a conditional statement - if this is the main page, then this link is active, but if this is not the main page, then the link is not active.

        I am still very much a newbie but I’m getting the hang of it.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          There are two settings for this, one to indicate the active page plus all of its parents, and one to indicate the current page. &selfClass=`current` would add a class "current" to the classnames placeholder. So the current page would have two classnames, class="current active". You just need to add an extra layer to the specification of the current class:
          .active {background:blue;}
          li.current {background:green;}
          #mainmenu .current {background:yellow;}
          

          CSS works on a point system, the more points a selector has will determine if it overrides selectors that would otherwise style it. For example a block of global styles is common, while a more specific selector will override the global directive.
          http://htmldog.com/guides/cssadvanced/specificity/
            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
            • 16183
            • 1,390 Posts
            Susan, cartierbailey, etc

            My tests show that Wayfinder does not apply &selfClass and &hereClass to the startItemTpl. On the other hand &firstClass and &parentClass are applied. Could you guys please confirm this? ATM, I can’t think of a reason why this is the case hmmm...it’s probably obvious but too tired to think atm...:D

            cheers/k
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Well, by definition that item is in the active path. It is the parent of the current page in every case, so it doesn’t need the hereClass since it’s obviously "here". And it cannot have the selfClass, since it is the parent and never the page you are actually visiting. If you really want it to have that class for some reason, add it in a custom startItemTpl chunk.

              It is not taken from the same query as the rest of the Wayfinder list, since it is the document specified in the &startId parameter. So no, it isn’t part of the loop creating each line in the menu structure.
                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
                • 16183
                • 1,390 Posts
                Aah...that makes sense. Thx for the clear explanation Susan.:)

                cheers/k
                  • 14
                  • 9 Posts
                  Hey guys,

                  I was just wondering. I’m making a navigation setup pretty much exactly the same way, except instead of having 2 menus (ie a main menu along the top and page context sensitive menu on the side), it’s all one main menu along the side (So it’s a three tier menu where the first tier are the main page headings, second tier are normal links and third tier are links related to the second tier parent link, but only visible when the browser is at one of the pages).

                  I was just testing and it looks like that UltimateParent solution doesn’t work in a situation like this. But could it be modified easily to work?

                  Sorry about potentially threadjacking this thread. I wasn’t sure this question was different enough to warrant a new one.

                  Thanks!

                  -TiM
                    • 16183
                    • 1,390 Posts
                    Hi TiM,

                    Welcome to MODx! smiley

                    UltimateParent should still work. If by tiers you mean this.....

                    1st tier
                    Home
                    About
                    Contact

                    2nd tier
                    Child of home
                    child of about
                    child of contact

                    3rd tier
                    child of child of home
                    child of child of about
                    child of child of contact

                    Then I think you will need 3 Wayfinder calls, one for each tier. In the 3rd tier you will need UltimateParent for it to be contexual. There are other parameters you will need so as to tell Wayfinder where to start the individual menus from or what to exclude/include in the menu...especially the second tier

                    If by tier, on the other hand, you are referring to a 3 level hierarchy...such as

                    Home
                    Child of home
                    child of child of home..

                    Then that is a bit more tricky with the 3 level being context sensitive... of course not..am being silly..This would be accomplished using &hideSubMenus=`TRUE` and &level=`3` with one WF call...I doubt this is what you mean though laugh

                    Sorry for the quick answer...I really need to go to bed wink

                    cheers/k
                      • 14
                      • 9 Posts
                      Hey kongondo, thanks very much for the warm welcome! grin

                      Yeah that’s exactly what I mean! And the links in tier 3 should only be visible if you’re actively on on tier 3 or the tier 2 parent.

                      Hmmm okay. That’s basically what I as already thinking/trying to do, but I couldn’t get it working.
                      I’m guessing the way to nest this is to put a new Wayfinder call in each chunk that is being called by the previous WayFinder call.

                      I think the problem with that tho, is that you can’t seem to nest uncached snippets inside chunks, that are getting rendered by other snippets. And setting everything to cached ([[UltimateParent]] inside [[Wayfinder]], there are escaping errors...

                      I’m thinking it may be easier to manually break this thing up into 2 separate menus (like the original question here hehe), but I’m hoping not. wink

                      Anyway, thanks for your help! I’m still amazed at how great MODx is. Within 24 hours, I’ve already gone from not knowing a thing about it, to asking really obscure coding questions. laugh

                      -TiM