We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7690
    • 166 Posts
    I have a menu where this is the snippetcall:
    [!Wayfinder?startId=`0` &rowTpl=`main.RowTpl` &hereTpl=`main.HereTpl` &parentRowHereTpl=`main.parentRowHereTpl` &activeParentRowTpl=`main.activeParentRowTpl` &level=`1`!]


    It show only the parent menu items.
    Everything works fine. But now I have an menu item with childeren.
    What i would like is when the user is on the child page, the parent menu item is active.

    With the above snippet call it doesn’t work.

    TPL for the parentRowHere and activeParentRow:
    <li class="active"><a href="[+wf.link+]" title="[+wf.title+]" id="[+linkClass+]">[+wf.linktext+]</a>[+wf.wrapper+]</li>
      • 5340
      • 1,624 Posts
      add [+wf.classes+] to your template
        • 7690
        • 166 Posts
        hhmm...
        I have now this:
        <li class="active" [+wf.classes+]><a href="[+wf.link+]" title="[+wf.title+]" id="[+linkClass+]">[+wf.linktext+]</a>[+wf.wrapper+]</li>

        But it still won’t work.
          • 16183
          • 1,390 Posts
          Quote from: DNA at Jul 15, 2009, 02:27 AM

          hhmm...
          I have now this:
          <li class="active" [+wf.classes+]><a href="[+wf.link+]" title="[+wf.title+]" id="[+linkClass+]">[+wf.linktext+]</a>[+wf.wrapper+]</li>

          But it still won’t work.

          DNA,

          What do you mean by it doesn’t work? Does it mean the CSS is not being applied or the tpl?

          A couple of questions:

          1. the <li class="active".....: This might cause a conflict in your CSS since by default, WF will apply the class "active" to all currently active menu items. So, if you are also using that same name, this might bring about undesired effect?

          2. Is [+linkClass+] a custom placeholder? (it isn’t a WF one)

          Unless you want to structure the active parent documents differently, you really don’t need to use activeParentRowTpl. This is because WF will automatically add an "active" class to all currently active menu items - children, parent, grandparent, etc...(it does this using the hereClass).

          &hereClass
          default: active
          values: name of class
          description: The hereClass will be applied to the current item and to each parent up the document tree.

          So, all you need to do is create some styles for the "active" class. Hope this helps.

          cheers/k
            • 7690
            • 166 Posts
            Quote from: kongondo at Jul 15, 2009, 04:06 AM

            Quote from: DNA at Jul 15, 2009, 02:27 AM

            hhmm...
            I have now this:
            <li class="active" [+wf.classes+]><a href="[+wf.link+]" title="[+wf.title+]" id="[+linkClass+]">[+wf.linktext+]</a>[+wf.wrapper+]</li>

            But it still won’t work.

            DNA,

            What do you mean by it doesn’t work? Does it mean the CSS is not being applied or the tpl?
            The TPL isn’t applied. The menu works fine, the css works fine.
            But the class="active" isn’t set to the parent item.



            Quote from: kongondo at Jul 15, 2009, 04:06 AM

            A couple of questions:

            1. the <li class="active".....: This might cause a conflict in your CSS since by default, WF will apply the class "active" to all currently active menu items. So, if you are also using that same name, this might bring about undesired effect?
            i tried first without setting class="active" in the tpl. But when i don’t do this. WF doesn’t apply an active class to the current menu item.


            Quote from: kongondo at Jul 15, 2009, 04:06 AM



            2. Is [+linkClass+] a custom placeholder? (it isn’t a WF one)

            Unless you want to structure the active parent documents differently, you really don’t need to use activeParentRowTpl. This is because WF will automatically add an "active" class to all currently active menu items - children, parent, grandparent, etc...(it does this using the hereClass).

            &hereClass
            default: active
            values: name of class
            description: The hereClass will be applied to the current item and to each parent up the document tree.

            So, all you need to do is create some styles for the "active" class. Hope this helps.

            cheers/k
            Yes, LinkClass is a custom placeholder.

            But the hereClass just isnt working here.

            My tree:
            - HOME
            - ITEM1
            - ITEM2
            - child1
            - child2

            So when im on child1, the ITEM2 should be active. But it isn’t.
            But i have tried to change the active in mij tpl to "current".
            But it still don’t work.

            My updated hereTpl:
            <li class="current"><a href="[+wf.link+]" title="[+wf.title+]" id="[+linkClass+]">[+wf.linktext+]</a>[+wf.wrapper+]</li>


            It works when im on a parent page, but when i go to a child page, the parent isn’t active anymore.
              • 16183
              • 1,390 Posts
              Strange...

              How does your WF call look like? The one you have in your first post has &level=`1`.

              If this is not a local site, if you like I can have a look at it (create a temp admin account and PM me the details).

              /k

                • 7690
                • 166 Posts
                you’ve got mail pm wink
                  • 16183
                  • 1,390 Posts
                  Seen it wink

                  Lemme have a look...

                  cheers/k
                    • 5340
                    • 1,624 Posts
                    Did you try &parentRowHereTpl
                      • 16183
                      • 1,390 Posts
                      DNA,

                      Fixed.

                      As Cipa mentioned in a post above, you were missing [+wf.classes+] in your tpls. I added the placeholder and removed the custom class you had "current". However, since you have current in your CSS, I added &hereClass=`current` in your WF call. Have a look and tell me if that’s what you were after.

                      As I mentioned earlier, I don’t think u need the hereTpl in your case. It’s not doing anything structurally and is basically a duplicate of the rowTpl. The hereClass should be enough.

                      cheers/k

                      cheers/k

                      ps: I am posting this (in addition to PM-ing you) so as to help the next person....