Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

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

Started by Muut Archive 10 years ago · 2 replies · 420 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 2288 9 years ago
Archive · by Muut Archive, 9 years ago
2 1501 9 years ago
Archive · by Muut Archive, 9 years ago
2 4754 9 years ago
Archive · by Muut Archive, 9 years ago
1 3570 9 years ago
Archive · by Muut Archive, 9 years ago
3 1627 9 years ago