Skip to content

Instantly share code, notes, and snippets.

@laurentsab
Created November 27, 2015 14:27
Show Gist options
  • Save laurentsab/1a3a7871a12f5ec19bad to your computer and use it in GitHub Desktop.
Save laurentsab/1a3a7871a12f5ec19bad to your computer and use it in GitHub Desktop.
Twig Loop modulo
<div class="row">
<div class="col-md-9">
<div class="row">
{% if children is defined and children.pager.currentPageResults|length %}
{% for child in children.pager.currentPageResults %}
{% if loop.index0 % 2 == 0 and not loop.first %}
</div>
<div class="row">
{% endif %}
<div class="col-xs-6">
{% if loop.index0 % 2 == 0 %}
{{ render_esi( controller( 'ez_content:viewLocation', { 'locationId': child.id, 'viewType': 'bloc', "params": { "couleur": "bleu" } } ) ) }}
{% else %}
{{ render_esi( controller( 'ez_content:viewLocation', { 'locationId': child.id, 'viewType': 'bloc', "params": { "couleur": "orange" } } ) ) }}
{% endif %}
</div>
{% endfor %}
{% endif %}
</div>
</div>
<div class="col-md-3">
<!-- Bloc -->
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment