php - Twig if/else not working -


i'm not sure why code isn't executing. know should working way happens doesn't else portion.

in debugging know descriptions not null , descriptions show have it.

{% if descriptions not null %} {{ dump(descriptions) }}     {% description in descriptions %}         <td>{{ description.productdesciption }}</td>     {% endfor %} {% else %}     <td>          <a href = "{{ path('description') }}">create description product</a>     </td> {% endif %} 

you can simplify using the else clause of statement:

{% description in descriptions %}      <td>         {{ description.productdesciption }}      </td> {% else %}      <td>          <a href = "{{ path('description') }}">create description product</a>     </td> {% endfor %} 

hope help


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -