If you are looking to use if condition in for loop with twig template. Please review the below example.
<table>
{% for category in categories if category.active %}
<td>{{ category.title }}</td>
{% else %}
<td>Category is not active</td>
{% endfor %}
</ul>
In the above example you can see we will list only active category in the table and we will show massage "Category is not active" for deactive categories.
0 Comment(s)