I use Twig template engine. And here is the situation: In the table for example, there are 2 people. They have the same name, and the last names are different: Ivan-Ivan Ivan-Andreev Vasya-Popov Vasya-horn ............ And I have a table, the first column is the name, and in the second is the last names. I would like to do something like this:

<table> <tr><th><Name></th><th>Family</th></tr> <tr><td>Иван</td><td>Иванов<hr>Андреев</td></tr> <tr><td>Вася</td><td>попов<hr>Рожков</td></tr> </table> 

That is, names, divided by tag <hr> . I tried to print through the cycle like this:

  {% for arru in arr %} <tr><td> {{ arru }} </td></tr> {% endfor %} 

But don `t know how to cram names .. How do I understand they also need a cycle ??? Tell me pliz ..

    1 answer 1

     <table> <tr><th><Name></th><th>Family</th></tr> {% for arru in arr %} <tr><td>{{ arru.first }}</td><td>{{ arru.last }}</td></tr> {% endfor %} </table> 

    Accordingly, arru necessary to transmit arru something like this:

     $template->render( array('arru' => array( array('first' => 'Иван', 'last' => 'Иванов'), array('first' => 'Вася', 'last' => 'попов') )) ); 

    I hope that clearly announced