IF a == true OR b = = true
No puedo encontrar una manera de hacer que TWIG interprete la siguiente declaración condicional:
{% if a == true or b == true %}
do stuff
{% endif %}
¿Me estoy perdiendo algo o no es posible?
50
2 answers
116
Author: Andreu Heineken,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-11-30 14:45:23
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-11-30 14:45:23
Las expresiones de comparación deben estar cada una entre corchetes:
{% if (a == 'foo') or (b == 'bar') %}
...
{% endif %}
Alternativa si está inspeccionando una sola variable y un número de valores posibles:
{% if a in ['foo', 'bar', 'qux'] %}
...
{% endif %}
16
Author: Tim,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-10-16 06:29:20
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-10-16 06:29:20