I am using the twig templating engine.
I basically have an array looping through resources which is fine however I have added another array within it which has a key, based on the loop index in the top level array
So it looks like
array("0" => array("a", "b",
"1" => array("d", "e");
and an array which goes
array("0" => array("food", "drink",
"1" => array("sport", "games");
If I do {{loop.index}} I get 0 and 1 from the first array which is fine
What I want to do is pass the {{loop.index}} into this for loop
{% for embedData in shareData %}
{{embedData.embed}}
{% endfor %}
So I can get the array value from the second array based on the first arrays key
Is there anyway to do this ?
You can acheive it this way, example assuming colours and teams are two arrays
PHP
View
Output
Basically they can be called by dot notation and well as an array in twig, my tests didn’t show a 0 index though only 1, 2, 3 using Silex twig extension to test