0

Tenho um array com a seguinte estrutura:

array(20) {
  [0]=>
  array(13) {
    ["id_question"]=>
    string(10) "1312352154"
    ["date_created"]=>
    string(19) "2018-06-20 18:08:38"
    ["anuncio"]=>
    string(12) "XXXXX"
  }
  [1]=>
  array(13) {
    ["id_question"]=>
    string(10) "1231312313"
    ["date_created"]=>
    string(19) "2018-06-20 18:46:13"
    ["anuncio"]=>
    string(12) "ZZZZZ"
  }
  [2]=>
  array(13) {
    ["id_question"]=>
    string(10) "1231312313"
    ["date_created"]=>
    string(19) "2018-06-17 22:52:18"
    ["anuncio"]=>
    string(12) "YYYYY"
  }

Não estou conseguindo imprimir ele no twig. Tentei desta forma.

{% extends 'formulario/layout.html' %}

{% block formulario %}

<h1> Home </h1>

{% for i in 0..20 %}

 <li>  {{ 0.id_question  }} </li>
 <li>  {{ 0.date_created }} </li>
 <li>  {{ 0.anuncio      }} </li>

{% endfor %}

{% endblock %}

1 Resposta 1

0

Tenta:

{% for var in i %}

 <li>  {{ var.id_question  }} </li>
 <li>  {{ var.date_created }} </li>
 <li>  {{ var.anuncio      }} </li>

{% endfor %}

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .