From: Fabien Potencier Date: Sat, 18 Dec 2010 12:44:51 +0000 (+0100) Subject: fixed if tag documentation X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=e782d41963b6674eaaf9d7f10b07fabe0fa0dbc9;p=web%2Fkonrad%2Ftwig.git fixed if tag documentation --- diff --git a/doc/templates.rst b/doc/templates.rst index 30d6b24..33e0844 100644 --- a/doc/templates.rst +++ b/doc/templates.rst @@ -604,9 +604,8 @@ course this is not limited to commas: If ~~ -The ``if`` statement in Twig is comparable with the if statements of PHP. In the -simplest form you can use it to test if a variable is defined, not empty or -not false: +The ``if`` statement in Twig is comparable with the if statements of PHP. In +the simplest form you can use it to test if a variable is not empty: .. code-block:: jinja @@ -618,6 +617,11 @@ not false: {% endif %} +.. note:: + + If you want to test if the variable is defined, use ``if users is + defined`` instead. + For multiple branches ``elseif`` and ``else`` can be used like in PHP. You can use more complex ``expressions`` there too: