Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

if variable twig on symfony

Tags:

twig

symfony

I would like to do a test on the values ​​selected by the select tag multiple. I tried with this code, but I get this error:

A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "punctuation" of value "{" in AdminBlogBundle:GestionGraph:graphkpi1.html.twig at line 575

{% for liste in Col1_Array %}
    {% if {{liste}} is "Call Drop" %}
     <div id="chartdiv" style="width: 100%; height: 400px;"></div>
    {% else %}
      <div id="chartdiv1" style="width: 100%; height: 400px;"></div>
    {% endif %}
{% endfor %}

Who can help me please?

like image 707
user1855861 Avatar asked Dec 11 '22 20:12

user1855861


1 Answers

You can't nest delimeters like that.

Correct syntax would be:

{% if liste == "Call Drop" %}
like image 131
Clarence Avatar answered Dec 29 '22 13:12

Clarence