4

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?

3 Answers 3

10

You can't nest delimeters like that.

Correct syntax would be:

{% if liste == "Call Drop" %}
Sign up to request clarification or add additional context in comments.

Comments

5

Fairly sure your line:

{% if {{liste}} is "Call Drop" %}

Should be:

{% if liste is "Call Drop" %}

2 Comments

even if I drop call list == I can not find the graphs and if I do I have the two graphs <div id="chartdiv" style="width: 100%; height: 400px;"></div> <div id="chartdiv1" style="width: 100%; height: 400px;"></div>
hello if I tried to, but I have nothing {% for liste in Col1_Array %} {% if liste == "Call Drop" %} <div id="chartdiv" style="width: 100%; height: 400px;"></div> {% else %} <div id="chartdiv1" style="width: 100%; height: 400px;"></div> {% endif %} {% endfor %}but if I put everything works {% for liste in Col1_Array %} {% if liste == "Call Drop" %} <div id="chartdiv" style="width: 100%; height: 400px;"></div> {% endif %} <div id="chartdiv1" style="width: 100%; height: 400px;"></div> {% endfor %}
0

Try

{{ dump(liste) }}

to find out what really is being evaluated.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.