Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

twig batch

{% set items = ['a', 'b', 'c', 'd'] %}

<table>
    {% for row in items|batch(3, 'No item') %}
        <tr>
            {% for column in row %}
                <td>{{ column }}</td>
            {% endfor %}
        </tr>
    {% endfor %}
</table>
Source by twig.symfony.com #
 
PREVIOUS NEXT
Tagged: #twig #batch
ADD COMMENT
Topic
Name
8+6 =