Php Smarty将图像分割到循环中间的第二行
我有一组按顺序排列的图像: 1-3是主要图像。 3+是缩略图 Q) 如何在两行上分开拇指 例如:Php Smarty将图像分割到循环中间的第二行,php,smarty,Php,Smarty,我有一组按顺序排列的图像: 1-3是主要图像。 3+是缩略图 Q) 如何在两行上分开拇指 例如: {section name=“i”loop=$images.rows} {assign var=“rows”value=$images.rows[i]} {如果$smarty.section.i.index=3} {/if} {/section} 因此,我需要添加一些内容,{if$thumbs\u count>=$smarty.section.I.index}{/if},这样在第二个循环的中途就
{section name=“i”loop=$images.rows}
{assign var=“rows”value=$images.rows[i]}
{如果$smarty.section.i.index=3}
{/if}
{/section}
因此,我需要添加一些内容,
{if$thumbs\u count>=$smarty.section.I.index}{/if}
,这样在第二个循环的中途就出现了。设法解决了这个问题
{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}
{math assign=“total_row_split”equation=“floor((total-main)/division)”总计=$images.rows |@count division=2 main=3}
{counter start=0 print=false assign=“thumbs\u count”}
{section name=“i”loop=$images.rows}
{assign var=“rows”value=$images.rows[i]}
{如果$smarty.section.i.index>=3}
{if$thumbs\u count==$total\u row\u split}
{/if}
{计数器打印=false}
{/if}
{/section}
{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}