- Smarty 4.1.1 → 4.5.6 (behebt dynamic property deprecations) - Core-Klassen: #[\AllowDynamicProperties] für Admin_role, base, Config, Customer, Customer_group, CustomerGroups, Item, Structure, website - website.class.php: counts[parent_id] initialisieren vor ++ (PHP 8.1) - layout.class.php: HTTP_ACCEPT_LANGUAGE mit isset-Guard - website_init.php: session_status()-Check vor session_start - .htaccess: HTTPS-Redirect via X-Forwarded-Proto (statt SERVER_PORT) - themes/easyshop_advanced/media/: Parent-Theme-Assets nachgezogen - .gitignore: smarty.4.1.1.bak ausschließen
2.4 KiB
2.4 KiB
{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.
Attributes
| Attribute Name | Required | Description |
|---|---|---|
| name | No | The name of the cycle |
| values | Yes | The values to cycle through, either a comma delimited list (see delimiter attribute), or an array of values |
| No | Whether to print the value or not (defaults to true) | |
| advance | No | Whether or not to advance to the next value (defaults to true) |
| delimiter | No | The delimiter to use in the values attribute (defaults to ',') |
| assign | No | The template variable the output will be assigned to |
| reset | No | The cycle will be set to the first value and not advanced (defaults to false) |
-
You can
{cycle}through more than one set of values in a template by supplying anameattribute. Give each{cycle}a uniquename. -
You can force the current value not to print with the
printattribute set to FALSE. This would be useful for silently skipping a value. -
The
advanceattribute is used to repeat a value. When set to FALSE, the next call to{cycle}will print the same value. -
If you supply the
assignattribute, the output of the{cycle}function will be assigned to a template variable instead of being output to the template.
Examples
{section name=rows loop=$data}
<tr class="{cycle values="odd,even"}">
<td>{$data[rows]}</td>
</tr>
{/section}
The above template would output:
<tr class="odd">
<td>1</td>
</tr>
<tr class="even">
<td>2</td>
</tr>
<tr class="odd">
<td>3</td>
</tr>