Thanks, Andrew! That is a good idea and seems like it should work,
however, it still does not. The range does not seem to play nice within
cycler.
If I use cycler on its own with a manual list [
cycler(0,1,2,3,4,5) ], it is ok. The range returns the list of numbers
fine. But when I combine them, cycler.next() returns:
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24.
I did notice you had an * before range which returned a parse error, so I removed it.
It does still appear as if scope is tricky in these templates. If I put the call to cycler.next() further down in the loop and reassign its value to a variable initially set outside the loop, it creates a new variable instead of updating the initial one.
Here is an example of what I am describing:
{% set myvar = 10 %}
{% set rowIndexer = cycler(0,1,2,3,4,5,6,7,8,9,10) %} {# NOTE: cycer(range(10)) does not work as next() will return entire list each time! #}
<div>{{ myvar }} will print 10 always here!</div>
{%-
set myvar = rowIndexer.next() %-}
<div>{{ myvar }} will print the next value in the cycler list here!</div>
{% endfor %}
And a snippet of the output looks like:
<div>10 will print 10 always here!</div>
<div>0 will print the next value in the cycler list here!</div>
<div>10 will print 10 always here!</div>
<div>1 will print the next value in the cycler list here!</div>
<div>10 will print 10 always here!</div>
<div>2 will print the next value in the cycler list here!</div>
<div>10 will print 10 always here!</div>
<div>3 will print the next value in the cycler list here!</div>