We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11858
    • 130 Posts
    I’m going to use a ditto call to populate a javascript array. I need it in format:

    myvar[0] = "this";
    myvar[1] = "that";
    myvar[2] = "the";
    myvar[3] = "other";
    


    Is there a placeholder that will increment a number for x results of a ditto call to populate the value within the square brackets?

    Cheers!
      • 26931
      • 2,314 Posts
      Hi Hat-rack,
      Is there a placeholder that will increment a number for x results of a ditto call to populate the value within the square brackets?
      [+ditto_iteration+]
        • 11858
        • 130 Posts
        Thanks sharkbait, the placeholder works as advertised =)

        The issue I’m having now is that the code looks like

        [[+ditto_iteration+]]
        


        Which doesn’t work as [[somethinghere]] is an uncached call in modx. Would you know how I force the square brackets around the number?
          • 26931
          • 2,314 Posts
          does adding spaces work? [ [+ditto_iteration+] ]