N
N
Nikita Gusakov2013-11-21 09:41:57
symfony
Nikita Gusakov, 2013-11-21 09:41:57

Twig and operator "!"?

Something now came across that construct:

{% if(!campaign) %}
    <p class="lead">За {{ date|date("d.m.Y") }} нет статистики по этой кампании</p>
{% endif %}

does not work, you have to use this crutch:
{% if(campaign) %}
{% else %}
    <p class="lead">За {{ date|date("d.m.Y") }} нет статистики по этой кампании</p>
{% endif %}

Are there other simple solutions?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MastaEx, 2013-11-21
@hell0w0rd

{% if not campaign %}

Q
Quber, 2014-06-27
@Quber

Another such option will also work

{% if campaign = false %}
    <p class="lead">За {{ date|date("d.m.Y") }} нет статистики по этой кампании</p>
{% endif %}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question