We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20364
    • 89 Posts
    Is there a variable in Wayfinder that allow me to see which cycle it is going through?

    For example, let’s say there are three child elements Wayfinder is cycling through. Here is the output I desire:

    <div id="tab01">
    <p>resource #251 content</p>
    </div>
    <div id="tab02">
    <p>resource #742 content</p>
    </div>
    <div id="tab03">
    <p>resource #111 content</p>
    </div>

    However, since each is a Chunk, the 01, 02, 03 needs to come from Wayfinder. Is there a variable so I could do something like <div id="tab[[+wf.something]]"> ??
      • 20364
      • 89 Posts
      There clearly doesn’t seem to be anything built in to Wayfinder. My only thought is using "menuindex" to simulate this, but I can’t figure out how to grab that inside a Wayfinder tpl. Anyone?
        • 16610
        • 634 Posts
        Try using &rowIdPrefix param, e.g. &rowIdPrefix=`tab` and then place it in your template chunk with [+wf.id+] placeholder.
          Mikko Lammi, Owner at Maagit
          • 20364
          • 89 Posts
          I don’t want the ID of the document, I want the order that it’s shown, starting with 01..

          01, 02, 03, 04, etc.

          That’s what I am struggling with
            • 16610
            • 634 Posts
            Ah, sorry. If you are using Evolution I would do it with Ditto if it’s not a multi-level menu. There’s a [+ditto_iteration+] placeholder.
              Mikko Lammi, Owner at Maagit
              • 20364
              • 89 Posts
              Revo sad
                • 32316
                • 387 Posts
                There clearly doesn’t seem to be anything built in to Wayfinder. My only thought is using "menuindex" to simulate this, but I can’t figure out how to grab that inside a Wayfinder tpl. Anyone?

                good start

                from http://muddydogpaws.com/development/wayfinder/parameters.html

                &textOfLinks
                default: menutitle
                values: [ id | menutitle | pagetitle | introtext | menuindex | published | hidemenu | parent | isfolder | description | alias | longtitle | type | template ]
                description: The field specified in the textOfLinks parameter will be inserted into the placeholder [+wf.linktext+].

                &titleOfLinks
                default: pagetitle
                values: [ id | menutitle | pagetitle | introtext | menuindex | published | hidemenu | parent | isfolder | description | alias | longtitle | type | template ]
                description: The field specified in the titleOfLinks parameter will be inserted into the placeholder [+wf.title+].

                implementation is left to the reader

                TMIYF The Manual Is Your Friend

                Revo grin
                  • 20407
                  • 82 Posts
                  To clarify the above hint, in your WF call you can use something like:
                  &titleOfLinks=`menuindex` 
                  and then put this in your template chunk:
                  <div id="tab[[+wf.title]]">
                  ...provided you don’t need the title attribute for its normal use, of course, and provided that you are allowing the Resources tree to set its own menu indexes when things are re-ordered by drag and drop (otherwise you might not get the numbers you’re expecting, i.e., 1, 2, 3...).
                    • 7858
                    • 97 Posts
                    I think, the easiest way is to use Jquery

                    $("#navigation").find("li").each(function(index){
                        var itemId = index+1;
                        $(this).attr("id", itemId);
                    })