|
|

|
{cycle}
{cycle} is used to alternate a set of values.
This makes it easy to for example, alternate between two or more colors
in a table, or cycle through an array of values.
You can {cycle} through more than one set of values in
a template by supplying a name attribute.
Give each {cycle} an unique name.
You can force the current value not to print with the
print attribute set to FALSE. This would be useful
for silently skipping a value.
The advance attribute is used to repeat a value.
When set to FALSE, the next call to {cycle} will print
the same value.
If you supply the assign attribute, the output of the
{cycle} function will be assigned to a template variable
instead of being output to the template.
Example 8-5. {cycle} {section name=rows loop=$data}
<tr bgcolor="{cycle values="#eeeeee,#d0d0d0"}">
<td>{$data[rows]}</td>
</tr>
{/section} |
The above template would output: <tr bgcolor="#eeeeee">
<td>1</td>
</tr>
<tr bgcolor="#d0d0d0">
<td>2</td>
</tr>
<tr bgcolor="#eeeeee">
<td>3</td>
</tr> |
|
|
|
[advertise]
|