A
A
Andrey Korekhov2019-07-26 17:22:02
Twig
Andrey Korekhov, 2019-07-26 17:22:02

for not working in twig?

Help me deal with for in twig docs read the video watched but the result is zero
php code

$records = $flat -> inputRecords;

echo $twig -> render('main.html', 
    [
  'house' => $flat -> house,
  'flat' => $flat -> flat, 
  'content' => $content,
  'input' => $input, 
  'FIO' => $flat -> Person['fio'],
  'PHONE' => $flat -> Person['phone'],
  'MONEY' => $flat -> Person['dolg'],
  'DATE' => $flat -> Person['date'],
  'records' => $records
  ]);

html code
{% for record in records %}
  <tr>
    <td>{{ record.date }}</td>
    <td>{{ record.ndoma }}</td>
    <td>{{ record.nkvart }}</td>
    <td>{{ record.ХВС1 }}</td>
    <td>{{ record.ГВС1 }}</td>
    <td>{{ record.ХВС2 }}</td>
    <td>{{ record.ГВС2 }}</td>
    <td>{{ record.t1 }}</td>
    <td>{{ record.t2 }}</td>
    <td>{{ record.autor }}
    {{ record.comment }}</td>
  </tr>
  {% endfor %}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sts, 2019-07-26
@Haotik

rename main.html to main.html.twig

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question