Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

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

Started by Muut Archive 10 years ago · 2 replies · 356 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 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2955 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago