PATH:
home
/
letacommog
/
laindinois
/
OLD
/
wp-content
/
plugins
/
responsive-menu
/
vendor
/
twig
/
twig
/
doc
/
filters
``batch`` ========= .. versionadded:: 1.12.3 The ``batch`` filter was added in Twig 1.12.3. The ``batch`` filter "batches" items by returning a list of lists with the given number of items. A second parameter can be provided and used to fill in missing items: .. code-block:: jinja {% set items = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] %} <table> {% for row in items|batch(3, 'No item') %} <tr> {% for column in row %} <td>{{ column }}</td> {% endfor %} </tr> {% endfor %} </table> The above example will be rendered as: .. code-block:: jinja <table> <tr> <td>a</td> <td>b</td> <td>c</td> </tr> <tr> <td>d</td> <td>e</td> <td>f</td> </tr> <tr> <td>g</td> <td>No item</td> <td>No item</td> </tr> </table> Arguments --------- * ``size``: The size of the batch; fractional numbers will be rounded up * ``fill``: Used to fill in missing items
[+]
..
[-] keys.rst
[edit]
[-] striptags.rst
[edit]
[-] trim.rst
[edit]
[-] spaceless.rst
[edit]
[-] join.rst
[edit]
[-] date.rst
[edit]
[-] index.rst
[edit]
[-] capitalize.rst
[edit]
[-] escape.rst
[edit]
[-] round.rst
[edit]
[-] nl2br.rst
[edit]
[-] raw.rst
[edit]
[-] slice.rst
[edit]
[-] number_format.rst
[edit]
[-] title.rst
[edit]
[-] first.rst
[edit]
[-] format.rst
[edit]
[-] batch.rst
[edit]
[-] sort.rst
[edit]
[-] split.rst
[edit]
[-] filter.rst
[edit]
[-] merge.rst
[edit]
[-] length.rst
[edit]
[-] map.rst
[edit]
[-] upper.rst
[edit]
[-] convert_encoding.rst
[edit]
[-] lower.rst
[edit]
[-] json_encode.rst
[edit]
[-] reverse.rst
[edit]
[-] reduce.rst
[edit]
[-] date_modify.rst
[edit]
[-] last.rst
[edit]
[-] url_encode.rst
[edit]
[-] replace.rst
[edit]
[-] abs.rst
[edit]
[-] default.rst
[edit]