Answer the question
In order to leave comments, you need to log in
Why doesn't if work properly in twig?
Hello
Either I'm doing something wrong, or something is wrong with twig...
A boolean variable is passed from the year, it is checked in the template, and depending on its state, the code should be executed:
{% if status == true %}
<p>Test.</p>
{% endif %}
{% if status == false %}
<p>Test.</p>
{% endif %}
array(1) { ["user_status"]=> string(1) bool(true) }
array(1) { ["user_status"]=> string(1) bool(true) }
Answer the question
In order to leave comments, you need to log in
are you sure you spelled it staus
correctly? may need status
?
upd
1) try redefining the variable from user-status
to user_status
(everywhere)
2) or the variable <code>user-status</code>
is not passed to the view
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question