Skip to content

Instantly share code, notes, and snippets.

@alrnz
Last active May 8, 2019 08:54
Show Gist options
  • Save alrnz/f96554782cd4b667a9a07f2ec841068c to your computer and use it in GitHub Desktop.
Save alrnz/f96554782cd4b667a9a07f2ec841068c to your computer and use it in GitHub Desktop.
TYPO3 Fluid flexible counter/iterator (count not every step) #TYPO3 #Fluid
<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
xmlns:flux="http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers">
<div>
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<v:variable.set name="i" value="0" />
<f:for each="{array}" as="elem" iteration="iterator">
val: {i} <br>
<f:if condition="{elem.field}">
<v:variable.set name="i" value="{v:math.sum(a: '{i}', b: '1')}" />
</f:if>
</f:for>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment