Sunday, 15 July 2012

php - Multidimensional Array on TWIG loop -


I am trying to save a few values ​​in a multirection on Twig, but for some reason this is not working .

I want to save the list of users and some values ​​to an array. I am using the merge function to create merge arguments.

{% result for %%} {% set users = users> merge ({('(' name '~ loop.index)): result .name, (' age ' Loop.index): result.age, ('credits' ~ loop.index): result.credits})%} {% endfor%}

Try this:

  {% set users = []%} {% result result%} {% set user = User | Merge ([{{'name': result.name, 'age': result.age, 'credits': result.credits}])%} {% endfor%}  

No comments:

Post a Comment