Package

ViewHelpers

ViewHelper Documentation

for

Loop view helper which can be used to interate over array. Implements what a basic foreach()-PHP-method does.

= Examples =

<f:for each="{0:1, 1:2, 2:3, 3:4}" as="foo">{foo}</f:for> 1234

  • fruit1: apple
  • fruit2: pear
  • fruit3: banana
  • fruit4: cherry

  • Index: 0 Cycle: 1 Total: 4 Odd First
  • Index: 1 Cycle: 2 Total: 4 Even
  • Index: 2 Cycle: 3 Total: 4 Odd
  • Index: 3 Cycle: 4 Total: 4 Even Last

Arguments

each anySimpleType, required

The array or \TYPO3\CMS\Extbase\Persistence\ObjectStorage to iterated over

as string, required

The name of the iteration variable

key string, required

The name of the variable to store the current array key

reverse boolean, required

If enabled, the iterator will start with the last element and proceed reversely

iteration string, required

The name of the variable to store iteration information (index, cycle, isFirst, isLast, isEven, isOdd)

ViewHelper Resources

Schema Resources