Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

How to output all values from a translated list?

Started by Jared 9 years ago · 2 replies · 900 views
9 years ago

Hi
I've got an array of words in my translation file but I want to display all the values on the page not just one. How do I write the for loop in twig?

YAML
en:
  homepage:
    wordlist: [January, February, March, April, May, June, July, August, September, October, November, December]

I want all the months to output so I tried things like

{% for word in homepage.wordlist[grav.language.getLanguage] %}

but get nothing back. Any idea what the syntax is?

9 years ago

Hi
Yes I can pull out individual values but how do I get all months returned not just one specific one?
{{ ta('MONTHS_OF_THE_YEAR',3) }} is fine for March but I'm stumped getting them all.

Suggested topics

Topic Participants Replies Views Activity
General · by themetman, 23 hours ago
2 40 16 hours ago
General · by Hanns Mattes, 1 week ago
0 121 1 week ago
General · by Karmalakas, 1 week ago
2 185 1 week ago
General · by Hanns Mattes, 3 weeks ago
0 235 3 weeks ago
General · by Dima, 4 weeks ago
1 211 4 weeks ago