Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Find out if any loop content in array from outside array?

Started by Muut Archive 10 years ago · 2 replies · 443 views
10 years ago

Hi, does anyone know how / if you can find out if an array has any loop content from outside it? So for example (this doesn't work):

TWIG
{% if page.header.page_nav.count > 0 %}
do something
{% endif %}

I can't do it from inside the loop otherwise this would work:

TWIG
{% for item in page.header.page_nav %}
{% if loop.first %}
do something
{% endif %}
{% endfor %}

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 2590 9 years ago
Archive · by Muut Archive, 9 years ago
2 1703 9 years ago
Archive · by Muut Archive, 9 years ago
2 4996 9 years ago
Archive · by Muut Archive, 9 years ago
1 3826 9 years ago
Archive · by Muut Archive, 9 years ago
3 1810 9 years ago