Package

ViewHelpers

ViewHelper Documentation

for

Loop view helper which can be used to iterate over arrays. 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 \SplObjectStorage to iterated over

as string, required

The name of the iteration variable

key string, required

Variable to assign array key to

reverse boolean, required

If TRUE, iterates in reverse

iteration string, required

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

ViewHelper Resources

Schema Resources