Question

I have a Symfony 2.1 version with a controller that returns the total of points. I am rendering this in my twig template as follows:

{%render "AdminBundle:Reports:getExpiringPoints" with {'id':dealer.id}%}

This prints the total points. I need to check that value and print it if the rendering value is greater that 0.

Is it possible in Symfony 2.1?

Was it helpful?

Solution

i found that :

    {% set x %}
        {%render "AdminBundle:Reports:getExpiringPoints" with {'id':dealer.id}%}
    {% endset %}

{% if x> 0 %}
  //display
{% endif %}

and after you can use it. Tell me if it works

OTHER TIPS

You can check it directly in the controller or with twig :

{% if var > 0 %}
  //display
{% endif %}

Twig supports all of the standard logical operators ==, !=, <, >, >=, and <=.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top