[TYPO3-mvc] FLUID: extended loop features

Sebastian Kurfürst sebastian at typo3.org
Wed Jan 6 18:48:32 CET 2010


Hi,

if you do:
<f:for each="{...}">
  <f:cycle values="{0: 'odd', 1: 'even'}" />
</f:for>
Then it will output "odd" "even" "odd" "even" as often as there are
elements in the loop. Isn't that what you want? :-)
(Exactly: The f:cycle has an internal counter which counts how often the
specific _instance_ of the f:cycle VH has been called)

Greets,
Sebastian
Am 06.01.10 18:34, schrieb Martin Kutschker:
> Sebastian Kurfürst schrieb:
>> Hey,
>>
>>
>>> More fun would a helper that cycles through a list given on the counter of the current loop:
>> <f:cycle> does exactly that ;)
> 
> No. "cycle" has its own object/array to iterate over. I want to cyle *within* another loop. In this
> case the "cycle" would take the iteration counter (via the rendering context?) from the referenced loop:
> 
> <f:for each="" as="" name="foobar">
> ...
> <li class="{f:loopCycle(values:{'odd','even'}), loop:'foobar'}">
> ...
> </f:for>
> 
> See the difference?
> 
> Masi



More information about the TYPO3-project-typo3v4mvc mailing list