Answers for "twig conintue loop"

0

twig break

{% set break = false %}
{% for post in posts if not break %}
    <h2>{{ post.heading }}</h2>
    {% if post.id == 10 %}
        {% set break = true %}
    {% endif %}
{% endfor %}
Posted by: Guest on May-28-2020
2

twig for

<ul>
    {% for key, user in users %}
        <li>{{ key }}: {{ user.username|e }}</li>
    {% endfor %}
</ul>
Posted by: Guest on July-16-2020

Browse Popular Code Answers by Language