I'm trying to print out value of the variable passed to the twig template. I'm using this code:
{{ naziv[0] }}
Index is 0 because passed array has only one element. Mentioned code produces following error:
Key "0" for array with keys "title" does not exist in...
but when I use for loop like this:
{% for key,value in naziv %}
{{ value }}
{% endfor %}
I get what I want.
What's wrong with {{naziv[0]}}
?
{{ dump(naziv) }}
get you? – phpisuber01array(1) { ["title"]=> string(11) "SpaceVision" }
– Xardasnaziv[0]
is not defined. – moonwave99