We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2602
    • 24 Posts
    Im trying to use Wayfinder 2.0 to output a menu where each <LI> tag has a unique name of some sort. Like this:

    <ul>
         <li class="nav_2">blah</li>
         <li class="nav_3">blah</li>
    </ul>
    


    I dont care what the class name is, it could be grabbing the page’s ID, alias, or whatever. It just needs to be unique.


    Currently, this is my wayfinder call:

    [[Wayfinder?startId=`0` &outerTpl=`mh.OuterTpl` &innerTpl=`mh.InnerTpl` &innerRowTpl=`mh.InnerRowTpl` &rowTpl=`mh.RowTpl` &firstClass=`first` &hereClass=`selected` &level=`1` &hideSubMenus=`false`]]

    can anyone help me out?
      • 11975
      • 2,542 Posts
      Hi,

      there are several ways to solve this.

      One of them is to use the [+wf.docid+] placheholder in your tpl

      <li id="nav_[+wf.docid+]">blah</li>

      :-)
        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 2602
        • 24 Posts
        Ah thanks helio. That works just fine. Is there a list of available "parameters" around to reference?
          • 31186
          • 20 Posts
          Almost there. I used the above tip (using doc id’s to make custom class names for each list item), but face a small challenge to complete it--getting it to work with "active" feature in Wayfinder. First, was the fact that I had an "a class" defined within each LI like this:

          <ul id="main-nav">
            <li><a class="id9" href="/contact.html" title="Contact">Contact</a></li>
            <li><a class="id12" href="/faq.html" title="Frequently Asked Questions">Frequently Asked Questions</a></li>
          </ul>
          


          So far, so good. Then I want to use the &hereClass setting to attempt to keep the button highlighted for the current page.

          [[Wayfinder? &startId=`44` &level=`3` &outerTpl=`top-menu-outer` &rowTpl=`top-menu`  &hereClass=`active`]]
          



          But of course since I am using my own class already, I couldnt figure out how to get the two to merge like this (i believe this is how CSS should be done:

          <a class="active id12">
          


          Putting in the &hereClass does not seem to do anything (the class="active" does not get generated at all) since I have my own class defined already. So, plan B was to try to use ID’s instead of CLASS’s. But it basically doesn’t work at all (at least in Firefox) since this is probably outside CSS’s specs, I am guess...
          E.g.

          <ul id="main-nav">
            <li><a id="id12" class="active" href="/faq.html" title="Frequently Asked Questions">Frequently Asked Questions</a></li>
          </ul>
          


          I am not a ModX, nor CSS pro by any means. I hired a company to create my CSS+HTML, so I have been doing what I can to integrate into Modx. It is also a volunteer job, so I am limited to forums for help. I appreciate any and all help offered. I am guessing there is a simple way to fix this using some other technique that I am unaware of.

          - thanks in advance
            • 7231
            • 4,205 Posts
            <ul id="main-nav">
              <li><a id="id12" class="active" href="/faq.html" title="Frequently Asked Questions">Frequently Asked Questions</a></li>
            </ul>

            In this case you should be able to style the active state with:
            #main-nav .active { color: #fff; }


            If you need to address each item individually you can try to add a <span> and put the custom ID in the span <span id="id12"> like this:
            <ul id="main-nav">
            	<li><span id="id12"><a class="active" href="faq.html" title="Frequently Asked Questions">Frequently Asked Questions</a></span></li>
            </ul>


            and you can style it like this:
            span#id12 a.active { color: red; }
              [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]
              • 31186
              • 20 Posts
              HOORAY !

              Hre is a simplified summary-->

              In my stylesheet:
              span#id45 a  {whatever styles}
              span#id46 a  {whatever styles}
              etc...
              


              My chunk:
              <li><span id="id[+wf.docid+]"><a [+wf.classes+]  href="[+wf.link+]">[+wf.linktext+]</a></span></li>


              My Wayfinder call:
               [!Wayfinder? &startId=`44` &rowTpl=`top-menu` &hereClass=`active` !]



              dev_cw, I owe you a pizza...

              /\
              / \
              / o \
              / o \
              /0 \
              ########
                • 7231
                • 4,205 Posts
                Good to hear. grin
                  [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]