Template : for loop alternative ? Eg : Generate html code for 5 times.


Well-known member

I made a form, where a user choose a number (let's say 5 as en example).

When he POST the request, I am sending to my template this number. I would like that, in the template, a code is generated XX times (5 times here).

Since it's a simple number, I don't get a way to parse it into my foreach loop (since foreach needs an array).

Any ideas ?



Well-known member
Create an array of that size before you call the template to be parsed and you can use xen:foreach.