Commit 53362fb5 authored by Mat's avatar Mat

tests twig

parent 8df5cef4
......@@ -27,4 +27,6 @@
</a>
{% endfor %}
{{ dump() }}
{% endblock %}
......@@ -13,16 +13,44 @@
{{ block('breadcrumb') }}
<h1>{{ block('title') }}</h1>
<h2>Hello {{ name }}</h2>
<p>{{ "I like %s, %s and %s."|format("foo", "bar", 42) }}</p>
<h3>Alternance</h3>
<table>
<h2>Hello {{ name }}</h2>
{% for i in 0..5 %}
<tr class="{{ cycle(['odd', 'even'], i) }}">
<td>
hop {{ i }}
</td>
<td>{{ i }}</td>
<td>hop {{ loop.index }}</td>
<td>{{ i is odd ? 'pair' : 'impair' }} </td>
<td>{{ i is even }} </td>
<td>{% if loop.index is divisible by(3) %} %3 {% endif %}</td>
<td>{% if i%3 == 0 %} %3 {% endif %}</td>
</tr>
{% endfor %}
</table>
<h3>Années</h3>
{% set start_year = date() | date('Y') %}
{% set end_year = start_year + 5 %}
{% for year in start_year..end_year %}
<p>
{{ year }}: {{ cycle(['pair', 'impair'], loop.index0) }}
</p>
{% endfor %}
<h3>Batch</h3>
{% set items = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] %}
<table>
{% for row in items|reverse|batch(3, '-') %}
<tr>
{% for column in row %}
<td>{{ column }}</td>
{% endfor %}
</tr>
{% endfor %}
</table>
{{ dump() }}
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment