Всем привет
как вывести вот в такой структуре,
<div>
<div class="double items">
<div>1</div>
<div>2</div>
</div>
<div>3</div>
<div>
<div>
<div class="double items">
<div>4</div>
<div>5</div>
</div>
<div>6</div>
<div>
<div>
<div class="double items">
<div>7</div>
<div>8</div>
</div>
<div>9</div>
<div>
$idx начинается с 1
{if $idx == 1 || $idx % 4 == 1}
<div class="ascents-section">
{/if}
{if $idx % 3 != 1}
<div class="ascents-section__item ascents-double">
{/if}
<div class="ascents-double__item" title="{$id | resource: 'pagetitle'}">
<div class="ascents-section__item-photo" id="photo-effect">
<picture>
<source media="(min-width: 1440px)" srcset="{$id | resource:'image'}">
<img class="effectImg" src="{$id | resource:'image'}" alt="{$id | resource: 'pagetitle'}">
</picture>
</div>
<div class="ascents-section__item-info">
<h2 class="for-heading">{$id | resource: 'pagetitle'}</h2>
<p class="subtitle">Легкий</p>
<a href="{$_modx->makeUrl($id)}" title="{$id | resource: 'pagetitle'}" class="button button-program">Перейти</a>
</div>
</div>
{if $idx % 3 == 1}
</div>
{/if}
{if $idx % 3 == 1}
<div class="ascents-section__item" title="{$id | resource: 'pagetitle'}">
<div class="ascents-section__item-photo" id="photo-effect">
<picture>
<source media="(min-width: 1440px)" srcset="{$id | resource:'image'}">
<img class="effectImg" src="{$id | resource:'image'}" alt="{$id | resource: 'pagetitle'}">
</picture>
</div>
<div class="ascents-section__item-info">
<h2 class="for-heading">{$id | resource: 'pagetitle'}</h2>
<p class="subtitle">Тяжелый</p>
<a href="{$_modx->makeUrl($id)}" title="{$id | resource: 'pagetitle'}" class="button button-program">Перейти</a>
</div>
</div>
{/if}
{if $idx % 3 == 1}
</div>
{/if}