Search code examples
typo3fluid

Iteration on basis of integer in TYPO3 Fluid


Is it possible to create an iteration that does not iterate over arrays but uses an integer instead? This is the example provided in the documentation:

<f:for each="{0:1, 1:2, 2:3, 3:4}" ...>

I am looking for the possibility to insert an integer which then defines the number of iterations. In JavaScript it would look like this:

for (let a = 0; a < iterations; a++) {...}

Solution

  • The core doesn't ship this, if you want to avoid a custom viewhelper and maybe even have a dependency on EXT:vhs you could use this one:

    https://viewhelpers.fluidtypo3.org/fluidtypo3/vhs/5.0.1/Iterator/For.html