Drupal 7的PHP代码:
<?php foreach ($rows as $row_number => $columns): ?>
<?php foreach ($columns as $column_number => $item): ?>
<?php print $item; ?>
<?php endforeach; ?>
<?php endforeach; ?>
我写了这个,但我在Drupal 8中收到错误。代码:
{% foreach row_number, columns in rows %}
{% foreach column_number, item in columns %}
{{ item }}
{% endforeach %}
{% endforeach %}
答案 0 :(得分:1)
在树枝中使用for
代替foreach
{% for row_number, columns in rows %}
{% for column_number, item in columns %}
{{ item }}
{% endfor %}
{% endfor %}