I am trying to generate background colors for multiple tables that are contained withing a {section} ... {/section}
block, but if I don't give names to the {cycle}
functions, the cycle is continued, not restarted the next time it is encountered. The same problem occurs when I use named cycles and the same named cycle repeats in a section.
Example:
{section name=i loop=$tables}
<table>
{section name=j loop=$tables[i].data}
<tr class="{cycle name=bgcolor values='odd_row,even_row'}">
..
..
..
</tr>
{/section}
</table>
{/section}
How can I get the {cycle}
to reset its self on each iteration of {section name=j}
? Is it possible to compose names in Smarty? (use something like {cycle name=bgcolor.$i}
)
Note: I have the same issue on another page which is included multiple times in a single .tpl and every time it shows a table, the background color cycle continues from where it left instead of resetting its self. I understand this is normal behavior (since there is no way for Smarty to know where my cycle begins), but I would like to change it.