ViewHelper Documentation


Grouped loop view helper. Loops through the specified values.

The groupBy argument also supports property paths.

= Examples =

<f:groupedFor each="{0: {name: 'apple', color: 'green'}, 1: {name: 'cherry', color: 'red'}, 2: {name: 'banana', color: 'yellow'}, 3: {name: 'strawberry', color: 'red'}}" as="fruitsOfThisColor" groupBy="color"> <f:for each="{fruitsOfThisColor}" as="fruit">


</f:for> </f:groupedFor> apple cherry strawberry banana

  • green fruits

      <li>0: apple</li>

  • red fruits

      <li>1: cherry</li>
      <li>3: strawberry</li>

  • yellow fruits

      <li>2: banana</li>

Note: Using this view helper can be a sign of weak architecture. If you end up using it extensively you might want to fine-tune your "view model" (the data you assign to the view).


each anySimpleType, required

The array or \SplObjectStorage to iterated over

as string, required

The name of the iteration variable

groupBy string, required

Group by this property

groupKey string, required

The name of the variable to store the current group

ViewHelper Resources

Schema Resources