Twig: in_array or similar possible within if statement?

后端 未结 6 700
终归单人心
终归单人心 2020-12-12 11:57

I am using Twig as templating engine and I am really loving it. However, now I have run in a situation which definitely mustbe accomplishable in a simpler way than I have fo

6条回答
  •  余生分开走
    2020-12-12 12:38

    It should help you.

    {% for user in users if user.active and user.id not 1 %}
       {{ user.name }}
    {% endfor %}
    

    More info: http://twig.sensiolabs.org/doc/tags/for.html

提交回复
热议问题