We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31037
    • 358 Posts
    Sorry if this should be obvious to me, but I need to get the output from Ditto numbered.

    I need to display a picture for each item, like <img src="assets/images/picNo[+itemOutputNumber+].gif" />.

    I made a quick fix by adding a number in the description field to each document beeing outputed and then used <img src="assets/images/picNo[+description+].gif" in the template.

    Works fine, but is an ugly solution, and I would need to edit *lots* of docs to add the number in description field.

    What is the correct solution for this? Is there a built in "counter"?

    Thanks! smiley
      • 4309
      • 4 Posts
      Not sure if you found the answer, but as it is not here, this should work. Ditto 2.
      placeholder "ditto_sort" seems to contain a numeric representation of the order of the documents. ie, 0,1,2...7,8,9. effectively a counter.
      in the place holder.
      <br /><img src="assets/images/picNo[+ditto_sort+].gif"<br />

      your ditto image call may need to include
      <br />[!Ditto? &paginate=`1` ... !]<br />
        currently working on a peer2php application
        • 28436
        • 242 Posts
        hello uncle

        have you found the [+ditto_iteration+] placeholder in the meanwhile?

        ciao, Stefan
          • 31037
          • 358 Posts
          Thank you for your answers, that will do it! smiley
            • 29635
            • 361 Posts
            The Man Can! Reply #5, 19 years ago
            So if I’m using [+ditto_sort+] or [+ditto_iteration+] in my template chunk, I should be seeing numbers?

            Not seeing anything in Ditto 2.0.2 (or 2.0.3) and MODx 0.9.6.1. Any thoughts?

            EDIT: Nevermind: While I’m not sure where ditto_sort works, I just saw that Ditto 2.1b2 has the ditto_iteration counter placeholder, so now it works.
              Need MODx Ecommerce? Try FoxyCart!