-
-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get the specified value in the array #815
Comments
Something like that should work: {% for image in post.images %}
{% if loop.index > 6 %}
{% break %} {# break out of the loop #}
{% endfor %}
<img src="{{image_1}}" class="{{loop.index }}" />
{% else %}
No img {# if the for-loop was never entered #}
{% endfor %} |
It doesn't work, my images is an |
Just use |
Thanks for your tip, I solved this problem by taking the length. |
For example, when the pictures in my array are larger than 6 pictures, I only need 3 of them. How can I get the value?
The text was updated successfully, but these errors were encountered: