Skip to content

Commit

Permalink
added a note about accessing variable attributes that contains operat…
Browse files Browse the repository at this point in the history
…ors (closes twigphp#775)
  • Loading branch information
fabpot committed Jul 18, 2012
1 parent fbd6f85 commit d70860f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions doc/templates.rst
Expand Up @@ -74,6 +74,15 @@ properties of a PHP object, or items of a PHP array), or the so-called
{{ foo.bar }}
{{ foo['bar'] }}
When the attribute contains special characters (like ``-`` that would be
interpreted as the minus operator), use the ``attribute`` function instead to
access the variable attribute:

.. code-block:: jinja
{# equivalent to the non-working foo.data-foo #}
{{ attribute(foo, 'data-foo') }}
.. note::

It's important to know that the curly braces are *not* part of the
Expand Down

0 comments on commit d70860f

Please sign in to comment.