We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29796
    • 91 Posts
    I have a navigation menu displaying product categories. Each first level category has a different color defined in TV called scheme. I wanted to apply css class to all main menuitems (parents without children).

    So I made this simple call:

    [[Wayfinder? &startId=`8` &rowTpl=`have a `]]


    and a chunk menu.item:

    <li [[+wf.parent:is=`8`:then=`class="cat[[+scheme]]"`]]>
        <a href="[[+wf.link]]" title="[[+wf.title]]">
            [[+wf.linktext]]
        </a>
        [[+wf.wrapper]]
    </li>
    


    for some reason class wasn't applied to LI, but funny thing is that, when I added [[+scheme]] inside link beside [[+wf.linktext]] that class filter inside LI started to work ??

    So basically this works !! but i don't want to have that scheme beside title:

    <li [[+wf.parent:is=`8`:then=`class="cat[[+scheme]]"`]]>
        <a href="[[+wf.link]]" title="[[+wf.title]]">
            [[+wf.linktext]] [[+scheme]]
        </a>
        [[+wf.wrapper]]
    </li>
    


    I solved this proble with custom snippet, but it bugs me what is wrong with previous solution??

    Another question .. is there a way to define differnet rowTpl for first level ?
    • That rowTpl doesn't look right.

      You can use rowTpl for the first level, then innerRowTpl for the inner levels. There are also tpls for items with children, parentRowTpl and parentRowHereTpl. I suggest you look over this carefully. https://rtfm.modx.com/extras/revo/wayfinder

      There is also a book and a cheatsheet available here http://sottwell.com/links/wayfinder.html
        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
        • 3749
        • 24,544 Posts
        In the tag, your rowTpl name has a trailing space. That would likely keep it from being found.

        &rowTpl=`have a `
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 29796
          • 91 Posts
          I misspeled that &rowTpl=`have a `, i have &rowTpl=`menu.item`.

          All works fine, menu is generated, just that

          [[+wf.parent:is=`8`:then=`class="cat[[+scheme]]"`]]


          works only if I also put [[+scheme]] somewhere inside LI and that is weird. I'll check it out "rowTpl" and "innerRowTpl" ..thanx for the tip.