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

How to output all values from a translated list?

Started by Jared 9 years ago · 2 replies · 780 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 Andy Miller, 6 days ago
0 106 6 days ago
General · by lynbor, 4 weeks ago
3 436 2 weeks ago
General · by lynbor, 3 weeks ago
7 555 2 weeks ago
General · by Harry, 2 weeks ago
0 159 2 weeks ago
General · by Old Man Umby, 1 month ago
2 308 3 weeks ago