1

私は順番に画像の配列を持っています:

1〜3枚がメイン画像です。3+はサムネイルです。

Q)親指を2行に分割するにはどうすればよいですか。

例えば:

<div class="main-images">
{section name="i" loop=$images.rows}
{assign var="rows" value=$images.rows[i]}
    {if $smarty.section.i.index <= 2}
    <img />
    {/if}
{/section}
</div>

<div class="thumbs-images">
{math assign=thumbs_count equation="total - other" total=$images.rowcount other=3}
{section name="i" loop=$images.rows}
{assign var="rows" value=$images.rows[i]}
    {if $smarty.section.i.index >= 3}
    <img />
    {/if}
{/section}
</div>

{if $thumbs_count >= $smarty.section.i.index}<div style="clear:both" />{/if}したがって、2番目のループの途中で表示されるように何かを追加する必要があります。

4

1 に答える 1

2

なんとかこれを理解することができました。

{math assign="total_row_split" equation="floor((total - main) / division)" total=$images.rows|@count division=2 main=3}
{counter start=0 print=false assign="thumbs_count"}
{section name="i" loop=$images.rows}
{assign var="rows" value=$images.rows[i]}
    {if $smarty.section.i.index >= 3}
    {if $thumbs_count == $total_row_split}<br style="clear:both" />{/if}
    <a href="{$HOME}/get/image{$rows.filename.fvalue}" rel="fancy" title="{$rows.title.value|default:$product.name.fvalue}">
        <img src="{$HOME}/get/image/120{$rows.filename.fvalue}" alt="{$rows.title.value|default:$product.name.fvalue} Picture" />
    </a>
    {counter print=false}
    {/if}
{/section}
于 2012-12-02T20:21:59.470 に答える