New variables to 'latest' tag

You now have access to index, index0, even and odd named variables within the 'latest' tag.

New variables to ‘latest’ tag

We have added a few variables to make creating snippets using the {% latest %}…{% endlatest%} tag a little easier. We added index, index0, even and odd.

Here is an example …

{% latest link: /store, total: 10 %} Index: {{ latest.index }} <br> Index (zero based): {{ latest.index0 }} <br> Even: {{ latest.even }} <br> Odd: {{ latest.odd }} <br> {% endlatest %}

index is a counter that increments each through each iteration. index0 is the same as index but starts counting at zero instead on one. even is either true or false depending on if index is an even number and you guessed it, odd is true when index is an odd number.

by Craig Sullivan

16 May 2012