請幫忙。我想出現圖像列表,每行3個圖像,而使用樹枝循環。我怎麼樣?在twig symfony中製作3列的每一行while looping twig
這裏是我的代碼
{% for siteAdministrator in siteAdministrators[5:] %}
{% if loop.index0 is divisibleby(3) %}
<section class="row team-members-row">
<div> array </div>
</section>
{% endif %}
{% endfor %}
UPDATE: 我的代碼目前的結果是..每行是這樣的1個圖像。
// 1st loop
<section class="row team-members-row">
<div class="other-team-members positionrelative floatleft withdropdown">
// image 1
</div>
</section>
// 2nd loop
<section class="row team-members-row">
<div class="other-team-members positionrelative floatleft withdropdown">
// image 2
</div>
</section>
// 3rd loop
<section class="row team-members-row">
<div class="other-team-members positionrelative floatleft withdropdown">
// image 3
</div>
</section>
and so on.. 1 image per row
我想出現像這樣的圖像。
// 1st loop
<section class="row team-members-row">
<div class="other-team-members positionrelative floatleft withdropdown">
// image 1
</div>
<div class="other-team-members positionrelative floatleft withdropdown">
// image 2
</div>
<div class="other-team-members positionrelative floatleft withdropdown">
// image 3
</div>
</section>
// 2nd loop
<section class="row team-members-row">
<div class="other-team-members positionrelative floatleft withdropdown">
// image 4
</div>
<div class="other-team-members positionrelative floatleft withdropdown">
// image 5
</div>
<div class="other-team-members positionrelative floatleft withdropdown">
// image 6
</div>
</section>
嗨,謝謝你,請閱讀我上面的更新,你不會顯示爲我上面的示例 – phpmeter
hi @jlacsonph我更新了我的答案,如果這不能滿足你的需要,你能更好地解釋嗎? – Matteo
謝謝你這麼工作 – phpmeter