We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32337
    • 28 Posts
    In the menu I’m building the output of &rowTpl looks like this:
    <li><a href="[+wf.link+]" title="[+wf.title+]"> <span>[+wf.linktext+] </span></a></li>

    and I need it to look like this:
    <li id="row_one_#"><a href="[+wf.link+]" title="[+wf.title+]"> <span>[+wf.linktext+] </span></a></li>

    I need that "#" to be a number, starting from 1 and incrementing for each row, so that if there are 4 links the first LI’s id is row_one_1 and the last LI’s id is row_one_4 I don’t see an inbuilt way to accomplish this and am worthless at PHP. Can someone help?

    Thanks.
      • 16183
      • 1,390 Posts
      You can use &rowIdPrefix as a workaround

      So, in your case add the parameter &rowIdPrefix=`row_one_` to your wayfinder call

      Then include [+wf.id+] in your rowTpl chunk.

      <li [+wf.id+]><a href="[+wf.link+]" title="[+wf.title+]"> <span>[+wf.linktext+] </span></a></li>


      WF will add row_one_#, where # corresponds to that document’s id. So, they won’t necessarily be 1, 2, 3, etc.

      The new WF 2.5 Beta though has an iterator placeholder. You can maybe use that for "true" increments, for instance in your rowTpl

      <li id="row_one_[+wf.iterator+]" [+wf.classes+]>
         <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>
         [+wf.wrapper+]
      </li>


      Should output exactly what you want. You won’t need to use the &rowIdPrefix in this case.

      more here: http://www.muddydogpaws.com/development/wayfinder/parameters.html and in the e-book in my sig (page 64).

      WF 2.5 beta here: http://modxcms.com/forums/index.php/topic,33904.0.html
      cheers/k
        • 32337
        • 28 Posts
        Thanks for the link to the beta, I’ll definitely try it out. I wonder if it’s safe to use on a production site?

        I should have mentioned I’d also tried [+wf.id+] before asking but didn’t like the results -- I was getting row_one_12 followed by row_one_3 etc. and consider it inelegant to change my CSS to correspond to the database. It is becoming increasingly clear that I must learn PHP one of these days sad

        Also, thank you for all the work you put into the e-book, I’d gone through most of it before posting here and found it extremely helpful in making sense of how everything fits together.
          • 16183
          • 1,390 Posts
          Quote from: whitless at Aug 19, 2009, 06:42 PM

          Thanks for the link to the beta, I’ll definitely try it out. I wonder if it’s safe to use on a production site?
          I think it is fine. There are people using it on live sites and haven’t reported any issues to the best of my knowledge. Don’t take my word for it though; send the developer an email?

          Also, thank you for all the work you put into the e-book, I’d gone through most of it before posting here and found it extremely helpful in making sense of how everything fits together
          Am glad you found it useful, thx smiley

          cheers/k
            • 32337
            • 28 Posts
            Worked as advertised, thanks again!
              • 16183
              • 1,390 Posts
              Quote from: whitless at Aug 20, 2009, 08:55 AM

              Worked as advertised, thanks again!

              Brilliant!

              cheers/k