diff options
author | Mario <mario@mariovavti.com> | 2022-02-11 09:27:57 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-02-11 09:27:57 +0000 |
commit | 615c9f1cbe2ccf9c33b035bcf04c5bc6bf64c7ed (patch) | |
tree | 9a2eb293fde70e7222957557dbfe6c3ab1df86f2 /vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-cycle.md | |
parent | 7d75d0cfbdca9914814dd5c8390a45eaf377b48d (diff) | |
download | volse-hubzilla-615c9f1cbe2ccf9c33b035bcf04c5bc6bf64c7ed.tar.gz volse-hubzilla-615c9f1cbe2ccf9c33b035bcf04c5bc6bf64c7ed.tar.bz2 volse-hubzilla-615c9f1cbe2ccf9c33b035bcf04c5bc6bf64c7ed.zip |
composer update smarty to version 4.1 - new files
Diffstat (limited to 'vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-cycle.md')
-rw-r--r-- | vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-cycle.md | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-cycle.md b/vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-cycle.md new file mode 100644 index 000000000..5986e6322 --- /dev/null +++ b/vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-cycle.md @@ -0,0 +1,57 @@ +{cycle} {#language.function.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. + + Attribute Name Type Required Default Description + ---------------- --------- ---------- ----------- ------------------------------------------------------------------------------------------------------------- + name string No *default* The name of the cycle + values mixed Yes *N/A* The values to cycle through, either a comma delimited list (see delimiter attribute), or an array of values + print boolean No *TRUE* Whether to print the value or not + advance boolean No *TRUE* Whether or not to advance to the next value + delimiter string No *,* The delimiter to use in the values attribute + assign string No *n/a* The template variable the output will be assigned to + reset boolean No *FALSE* The cycle will be set to the first value and not advanced + +- 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. + +<!-- --> + + + {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> + + |