We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1343 ☆ A M B ☆
    • 2,213 Posts
    Hello,

    I’m trying to recreate this menu structure with wayfinder, but can’t figure out how to get the last item to show up correctly.

    			<ul>
    				<li><a class="active" title="link one" href="index.html">Link One</a></li><li>|</li>
    				<li><a title="link two" href="index.html">Link Two</a></li><li>|</li>
    				<li><a title="link three" href="index.html">Link Three</a></li><li>|</li>
    				<li><a title="link four" href="index.html">Link Four</a></li><li>|</li>
    				<li><a title="link five" href="index.html">Link Five</a></li>
    			</ul>
    


    I know I can use rowTpl to get line 1-4 working correctly, but line 5 (last item) has me stumped. Can this be done?

    Thanks
    AMDbuilder
      Patrick | Server Wrangler
      About Me: Website | Tweets |  MODX Hosting
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Wayfinder sets a classname for the last item of every group. You can style these like ul li.last, ul ul li.last, etc to get the last row in each group. Control the classname with &last=`whatever`.
        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
        • 7231
        • 4,205 Posts
        I think the problem is that the last menu item does not have the trailing <li>|</li>. I am guessing that this is a horizontal menu and the <li>|</li> are delimiters. You could either use css and set a border-right or use a background image to recreate this rather than using the pipe. Or, if this is a single level menu just use Ditto which has a tplLast chunk where you could remove the pipe for the last row.
          [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]
          • 1343 ☆ A M B ☆
          • 2,213 Posts
          Hello,

          Thanks for the replies, I kinda figured what I wanted to do couldn’t be done with wayfinder, but you never know. I will try switching over to CSS to recreate the affect.

          Thanks
          AMDbuilder
            Patrick | Server Wrangler
            About Me: Website | Tweets |  MODX Hosting
            • 36926
            • 701 Posts
            Just trying to do the same sort of thing, after reading this post it made me think you could you place the | within a span and then in the CSS make the span display none.


            So for &rowTpl chunk use:

            <li[+wf.id+][+wf.classes+]><a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>[+wf.wrapper+]<span>&nbsp;|&nbsp;</span></li>


            The html output is:

            <ul>
            <li class="active">Menu 1<span>|</span></li>
            <li>Menu 1<span>|</span></li>
            <li class="last">Menu 1<span>|</span></li>
            </ul>


            And the CSS would be

            li.last span{display:none}

            Ben
              • 1343 ☆ A M B ☆
              • 2,213 Posts
              I don’t recall where I wanted to use this now, but it’s nice to have the solution!

              Thanks
              AMDbuilder
                Patrick | Server Wrangler
                About Me: Website | Tweets |  MODX Hosting