<table>
{% for row in items|batch(3, 'No item') %}
- <tr>
- {% for column in row %}
- <td>{{ column }}</td>
- {% endfor %}
- </tr>
+ <tr>
+ {% for column in row %}
+ <td>{{ column }}</td>
+ {% endfor %}
+ </tr>
{% endfor %}
</table>
.. code-block:: jinja
<table>
- <tr>
- <td>a</td>
- <td>b</td>
- <td>c</td>
+ <tr>
+ <td>a</td>
+ <td>b</td>
+ <td>c</td>
</tr>
- <tr>
- <td>d</td>
- <td>e</td>
- <td>f</td>
+ <tr>
+ <td>d</td>
+ <td>e</td>
+ <td>f</td>
</tr>
- <tr>
- <td>g</td>
- <td>No item</td>
- <td>No item</td>
+ <tr>
+ <td>g</td>
+ <td>No item</td>
+ <td>No item</td>
</tr>
</table>
Arguments
---------
- * ``from``: The input charset
- * ``to``: The output charset
+* ``from``: The input charset
+* ``to``: The output charset
.. _`iconv`: http://php.net/iconv
.. _`mbstring`: http://php.net/mbstring
.. code-block:: jinja
{{ post.published_at|date("m/d/Y") }}
-
+
The format specifier is the same as supported by `date`_,
except when the filtered data is of type `DateInterval`_, when the format must conform to
`DateInterval::format`_ instead.
Arguments
---------
- * ``format``: The date format
- * ``timezone``: The date timezone
+* ``format``: The date format
+* ``timezone``: The date timezone
.. _`strtotime`: http://www.php.net/strtotime
.. _`DateTime`: http://www.php.net/DateTime
Arguments
---------
- * ``modifier``: The modifier
+* ``modifier``: The modifier
.. _`strtotime`: http://www.php.net/strtotime
.. _`DateTime`: http://www.php.net/DateTime
Arguments
---------
- * ``default``: The default value
+* ``default``: The default value
Arguments
---------
- * ``strategy``: The escaping strategy
- * ``charset``: The string charset
+* ``strategy``: The escaping strategy
+* ``charset``: The string charset
.. _`htmlspecialchars`: http://php.net/htmlspecialchars
Arguments
---------
- * ``glue``: The separator
+* ``glue``: The separator
Arguments
---------
- * ``options``: A bitmask of `json_encode options`_ (``{{
- data|json_encode(constant('JSON_PRETTY_PRINT')) }}``)
+* ``options``: A bitmask of `json_encode options`_ (``{{
+ data|json_encode(constant('JSON_PRETTY_PRINT')) }}``)
.. _`json_encode`: http://php.net/json_encode
.. _`json_encode options`: http://www.php.net/manual/en/json.constants.php
{% if users|length > 10 %}
...
{% endif %}
-
If no formatting options are provided then Twig will use the default formatting
options of:
-- 0 decimal places.
-- ``.`` as the decimal point.
-- ``,`` as the thousands separator.
+* 0 decimal places.
+* ``.`` as the decimal point.
+* ``,`` as the thousands separator.
These defaults can be easily changed through the core extension:
Arguments
---------
- * ``decimal``: The number of decimal points to display
- * ``decimal_point``: The character(s) to use for the decimal point
- * ``thousand_sep``: The character(s) to use for the thousands separator
+* ``decimal``: The number of decimal points to display
+* ``decimal_point``: The character(s) to use for the decimal point
+* ``thousand_sep``: The character(s) to use for the thousands separator
.. _`number_format`: http://php.net/number_format
Arguments
---------
- * ``replace_pairs``: The placeholder values
+* ``replace_pairs``: The placeholder values
.. seealso:: :doc:`format<format>`
Arguments
---------
- * ``preserve_keys``: Preserve keys when reversing a mapping or a sequence.
+* ``preserve_keys``: Preserve keys when reversing a mapping or a sequence.
.. _`Traversable`: http://php.net/Traversable
Arguments
---------
- * ``start``: The start of the slice
- * ``length``: The size of the slice
- * ``preserve_keys``: Whether to preserve key or not (when the input is an array)
+* ``start``: The start of the slice
+* ``length``: The size of the slice
+* ``preserve_keys``: Whether to preserve key or not (when the input is an array)
.. _`Traversable`: http://php.net/manual/en/class.traversable.php
.. _`array_slice`: http://php.net/array_slice
Arguments
---------
- * ``delimiter``: The delimiter
- * ``limit``: The limit argument
+* ``delimiter``: The delimiter
+* ``limit``: The limit argument
.. _`explode`: http://php.net/explode
.. _`str_split`: http://php.net/str_split
Arguments
---------
- * ``character_mask``: The characters to strip
+* ``character_mask``: The characters to strip
.. _`trim`: http://php.net/trim
Arguments
---------
- * ``position``: The cycle position
+* ``position``: The cycle position
Arguments
---------
- * ``date``: The date
- * ``timezone``: The timezone
+* ``date``: The date
+* ``timezone``: The timezone
.. _`date`: http://www.php.net/date
Arguments
---------
- * ``context``: The context to dump
+* ``context``: The context to dump
.. _`XDebug`: http://xdebug.org/docs/display
.. _`var_dump`: http://php.net/var_dump
Arguments
---------
- * ``template``: The template to render
- * ``variables``: The variables to pass to the template
- * ``with_context``: Whether to pass the current context variables or not
- * ``ignore_missing``: Whether to ignore missing templates or not
- * ``sandboxed``: Whether to sandbox the template or not
+* ``template``: The template to render
+* ``variables``: The variables to pass to the template
+* ``with_context``: Whether to pass the current context variables or not
+* ``ignore_missing``: Whether to ignore missing templates or not
+* ``sandboxed``: Whether to sandbox the template or not
Arguments
---------
- * ``values``: The values
+* ``values``: The values
.. _`mt_rand`: http://php.net/mt_rand
Arguments
---------
- * ``low``: The first value of the sequence.
- * ``high``: The highest possible value of the sequence.
- * ``step``: The increment between elements of the sequence.
+* ``low``: The first value of the sequence.
+* ``high``: The highest possible value of the sequence.
+* ``step``: The increment between elements of the sequence.
.. _`range`: http://php.net/range
Arguments
---------
- * ``template``: The template
+* ``template``: The template
.. code-block:: jinja
{% filter upper %}
- This text becomes uppercase
+ This text becomes uppercase
{% endfilter %}
Go to the :doc:`filters<filters/index>` page to learn more about the built-in