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

    I am having some problems with my menu and submenu. You can check it here (Ignore the dutch text)
    If you already checked you may have noticed that something is wrong with the submenu. (links are displayed wrong) But when you click one of te subitems, that particular link is displayed correct. Only when you check the main menu none is active! So when on a subitem the directory/page that belongs to that subpage should be active.

    My calls:
    rowTpl:
    <li>
    <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]><span>[+wf.linktext+]</span></a>
    [+wf.wrapper+]
    </li>

    hereTpl:
    <li class="huidig">
    <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]><span>[+wf.linktext+]</span></a>
    [+wf.wrapper+]
    </li>

    hereSubTpl:
    <ul id="tabmenu">
    <li>
    <a href="[+wf.link+]" class="rtablink" [+wf.classes+] &activeParentRowTpl title="[+wf.title+]" &innerRowTpl &hideSubMenus [+wf.attributes+]>
    <img src="http://www.evd.timweb.nl/modx/assets/templates/hbs/images/icons/check.gif" alt="icon" />
    [+wf.linktext+]
    </a>
    </li>
    [+wf.wrapper+]
    </ul>

    maybe my css will help?

    Thanks anyway, hope you understand what I mean.


    Erwin
      • 7231
      • 4,205 Posts
      I think that you can resolve this with a &activeParentRowTpl template chunk.

      &activeParentRowTpl
      default: NULL
      values: name of template chunk
      description: The activeParentRowTpl template is used on the parent, grandparent, etc.. of the current item. The template is applied all the way up the document tree.

      Wayfinder by default uses the active, first and last classes. You can change the name of the classes in your call by defining the class names (see documentation for available class instances).
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 40944
        • 78 Posts
        Thanks! I’ll try it smiley
          • 40944
          • 78 Posts
          I tried, but it doesn’t work yet.

          Call Main menu:
          [!Wayfinder? &startId=`0` &level=`1` &rowTpl=`rowTpl` &hereTpl=`hereTpl`!]

          Call Sub menu:
          [!Wayfinder? &startId=`[[UltimateParent]]` &hereTpl=`hereSubTpl` &rowTpl=`hereSubTpl` &activeParentRowTpl=`activeParentRowTpl` !]

          rowTpl:
          <li>
          <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]><span>[+wf.linktext+]</span></a>
          [+wf.wrapper+]
          </li>

          hereTpl:
          <li class="huidig" [+wf.classes+]>
          <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]><span>[+wf.linktext+]</span></a>
          [+wf.wrapper+]
          </li>


          hereSubTpl:
          <li>
          <a href="[+wf.link+]" class="rtablink" [+wf.classes+] title="[+wf.title+]" [+wf.attributes+]>
          <img src="http://www.evd.timweb.nl/modx/assets/templates/hbs/images/icons/check.gif" alt="icon" />
          [+wf.linktext+]
          </a>
          </li>
          [+wf.wrapper+]

          EDIT:
          forgot this one:
          activeParentRowTpl:
          <li>
          <a href="[+wf.link+]" class="rtablink" [+wf.classes+] title="[+wf.title+]" [+wf.attributes+]>
          <img src="http://www.evd.timweb.nl/modx/assets/templates/hbs/images/icons/check.gif" alt="icon" />
          [+wf.linktext+]
          </a>
          </li>
          [+wf.wrapper+]

          greets Erwin
            • 40944
            • 78 Posts
            somebody? embarrassed I can’t be the first with a problem like this... shocked
              • 7231
              • 4,205 Posts
              Just to make sure I understood correctly.

              You want the main menu (ie: Home) to be active when in the submenu (ie: Test). At the moment the main nav is not active when in a sub menu.

              This needs to be done in the main menu call. Add a &activeParentRowTpl and have the same as the hereTpl (you can use the same chunk for both).

              [!Wayfinder? &startId=`0` &level=`1` &rowTpl=`rowTpl` &hereTpl=`hereTpl` &activeParentRowTpl=`hereTpl`!]


              By default Wayfinder works in this manner, which is the reason most people do not have this problem. However once you start using custom tpls things start working in a unique way. There is a ripple effect with some of the Tpl, where if you use one you need to fill in the blanks with others.

              Anyway, give this a try and let us know.
                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don&#39;t know what it is.
                Do you, Mr. Jones? - [bob dylan]
                • 40944
                • 78 Posts
                Thanks for your reply, I tried what you said, but it wouldn’t work.

                Hope you have more ideas rolleyes

                Greetz Erwin
                  • 7231
                  • 4,205 Posts
                  OK, this should do it...I am running out of sleeves shocked

                  1) change the rowTpl to:
                  <li [+wf.classes+]>
                     <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]><span>[+wf.linktext+]</span></a>
                     [+wf.wrapper+]
                  </li>


                  2) change the Wayfinder call to use the &hereClass parameter to set a custom here class:
                  [!Wayfinder? &startId=`0` &level=`1` &rowTpl=`rowTpl` &hereClass=`huidig`!]


                  Note that we are not using the hereTpl, by including the wf.classes placeholder the class should be placed automatically, and since we set it to use the ’huidig’ class as the here or active class it should work as expected.

                  I hope this works, in theory it should but I am loosing confidense since all of the above should have worked as well. shocked
                    [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                    Something is happening here, but you don&#39;t know what it is.
                    Do you, Mr. Jones? - [bob dylan]
                    • 40944
                    • 78 Posts
                    Yahoo! erhm.. I mean Yooohooo! it works =D

                    thank you very much!

                    You are the winner of "Most Promising Helping Person with Open Source CMS; HPwCMS Awards ’08" grin

                    greetz, Erwin.

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