We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18862
    • 70 Posts
    Is this just not possible? Here is what I’ve done and the results I’ve got:

    I’ve created a template variable with the following attributes:


    Then I put on each page the value in that TV for the class name I want to have listed for each <li> element:


    I use the following wayfinder snippet call in the template:

    [[Wayfinder?startId=`0` &outerClass=`nav` &rowTpl=`rowTpl` &rowClass=`[*classValue*]` &level=`1`]]


    And here is the content of my rowTpl chunk:



    I would expect that I would get a classname for each <li> element corresponding to the TV for the page that is associated with it. But instead I get the same class name for every <li> element.




    Any thoughts?
      • 5340
      • 1,624 Posts
      You can use javascript.
        • 18862
        • 70 Posts
        You’re saying just forget about using wayfinder and do it somehow with javascript?
          • 5340
          • 1,624 Posts
          That is one way but you can do it with Wayfinder.

          You can use the following parameters in your TPL

          [+wf.subitemcount+]
          OR
          [+wf.docid+]

          OR my favorite smiley

          [[Wayfinder? &startId=`0` &level=`1` &rowTpl=`mainMenuRowTpl` &titleOfLinks=`alias`]]
          +
          <li [+wf.classes+]>
          <a href="[+wf.link+]" [+wf.attributes+] title="[+wf.linktext+]" id="[+wf.title+]"></a>
          [+wf.wrapper+]
          </li>

          The trick is to use titleOfLinks and set the title to use the alias field. I personally set up modx to create the alias automatically. If you don’t do it like this you would have to enter the alias yourself. Because the alias is an unique field(almost all the time) you can use it as an ID.

          There are other ways to do it
          1: Latest wayfinder + phx + custom phx modifier
          2. Javascript: Get the name of the link replace special characters with - or _ and insert the id in the DOM




            • 22303 MODX Staff
            • 10,725 Posts
            You just need to use [+classValue+] in your rowTpl I believe.
              • 18862
              • 70 Posts
              You guys are so awesome. Thank you so much!
              OpenGeek - How in the world do you do it all? I can’t believe how involved you are in the forums AND STILL do all that you do for the actual development. Simply amazing. smiley
                • 5340
                • 1,624 Posts
                Quote from: OpenGeek at Oct 09, 2009, 08:31 PM

                You just need to use [+classValue+] in your rowTpl I believe.

                Hi OpenGeek,

                I can’t seem to find classValue in the wayfinder documentation. Will This be available in the newer version?

                Thx


                  • 22303 MODX Staff
                  • 10,725 Posts
                  Quote from: cipa at Oct 18, 2009, 12:46 PM

                  Quote from: OpenGeek at Oct 09, 2009, 08:31 PM

                  You just need to use [+classValue+] in your rowTpl I believe.
                  I can’t seem to find classValue in the wayfinder documentation. Will This be available in the newer version?
                  classValue was just the name of a Template Variable the OP was trying to render in his Wayfinder templates.