.. include:: /Includes.rst.txt
.. _typo3fluid-fluid-for:
===
for
===
Loop view helper which can be used to iterate over arrays.
Implements what a basic foreach()-PHP-method does.
= Examples =
{foo}
- Index: {fooIterator.index} Cycle: {fooIterator.cycle} Total: {fooIterator.total}{f:if(condition: fooIterator.isEven, then: ' Even')}{f:if(condition: fooIterator.isOdd, then: ' Odd')}{f:if(condition: fooIterator.isFirst, then: ' First')}{f:if(condition: fooIterator.isLast, then: ' Last')}
Arguments
=========
.. _for_each:
each
----
:aspect:`DataType`
mixed
:aspect:`Required`
true
:aspect:`Description`
The array or \SplObjectStorage to iterated over
.. _for_as:
as
--
:aspect:`DataType`
string
:aspect:`Required`
true
:aspect:`Description`
The name of the iteration variable
.. _for_key:
key
---
:aspect:`DataType`
string
:aspect:`Required`
false
:aspect:`Description`
Variable to assign array key to
.. _for_reverse:
reverse
-------
:aspect:`DataType`
boolean
:aspect:`Required`
false
:aspect:`Description`
If TRUE, iterates in reverse
.. _for_iteration:
iteration
---------
:aspect:`DataType`
string
:aspect:`Required`
false
:aspect:`Description`
The name of the variable to store iteration information (index, cycle, isFirst, isLast, isEven, isOdd)