Skip to content

Instantly share code, notes, and snippets.

@benjaminrau
Created September 25, 2013 13:19
Show Gist options
  • Save benjaminrau/6699467 to your computer and use it in GitHub Desktop.
Save benjaminrau/6699467 to your computer and use it in GitHub Desktop.
ChunkViewHelper Usage
Expected html markup:
<div class="container1">
<a>1. Link</a>
<a>2. Link</a>
<a>3. Link</a>
<a>4. Link</a>
<a>5. Link</a>
</div>
<div class="container2">
<a>6. Link</a>
<a>7. Link</a>
<a>8. Link</a>
<a>9. Link</a>
</div>
With this ViewHelper this is an easy task:
{links->v:iterator.chunk(count:2,fixed:1)->v:var.set(name:'chunks')}
<div class="container1">
<f:for each="{chunks.0}" as="item">{item}</f:for>
</div>
<div class="container2">
<f:for each="{chunks.1}" as="item">{item}</f:for>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment