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

How to output all values from a translated list?

Started by Jared 8 years ago · 2 replies · 658 views
8 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?

8 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 jean-louis67, 3 days ago
2 86 3 days ago
General · by Andy Miller, 1 week ago
0 147 1 week ago
General · by Veehem, 1 week ago
0 146 1 week ago
General · by milkboy, 1 week ago
0 144 1 week ago
General · by ian russell, 2 weeks ago
2 227 2 weeks ago