Hello,
Is it possible to use a variable as the index number or an array?
Something like this:
Every which way I try this, I get the following error: "Array Index Must Be a Positive Integer"
Any help would be appreciated!
Thanks!
Is it possible to use a variable as the index number or an array?
Something like this:
Code:
<mvt:assign name="g.counter" value="0" /> <----------- CREATE A VARIABLE NAMED 'COUNTER' <mvt:foreach iterator="sub_product" array="sub_products"> <mvt:assign name="g.counter" value="g.counter + 1" /> <----------- INCREASE THE VARIABLE BY 1, WITH EACH LOOP ITERATION <mvt:assign name="l.tracker[g.counter]" value="l.settings:sub_product:code" /> <----------- USE THE CURRENT 'COUNTER' VALUE AS THE ARRAY INDEX </mvt:foreach>
Any help would be appreciated!
Thanks!
Comment