I created the array in Twig and tried to output its values:
{% set comments = [
{'author': 'Bhaumik Patel', 'comment_body': 'Test comment body', 'date': '2 Aug 2013'},
{'author': 'Bhaumik Patel', 'comment_body': 'Test comment body', 'date': '2 Aug 2013'},
{'author': 'Bhaumik Patel', 'comment_body': 'Test comment body', 'date': '2 Aug 2013' },
] %}
Loop to iterate:
{% for key,item in comments %}
{% for comment in item %}
{{ attribute(comment, key).author }}
{% endfor %}
{% endfor %}
But I get a white screen. What I am doing wrong?
I tried to do it as described in Accessing array values using array key from Twig.