1
Basicly此代碼更復雜的給我< LI> 1 2 3 4 </LI> < LI> 1 2 3 4 </LI> < LI> 1 2 </LI>。所以基本上最後我需要把3和4換成不同的結果,例如,< li> 1 2空的空</li> - 因爲每個結果總是應該有4個結果< li> </li>,這很棘手,因爲循環給出儘可能多的東西,有時候會少一些:)。每一次出現,但
<ul>
{section name=attribs loop=$AccountHistory}
{if $smarty.section.attribs.index % 4 == 0 or $smarty.section.attribs.first}
<li>
{/if}
{$smarty.section.iteration}
{if $smarty.section.attribs.index % 4 == 3 or $smarty.section.attribs.last}
</li>
{/if}
{/section}
</ul>
是的,它的竅門,但奇怪的是沒有&&($ smarty.section.attribs.index%4)> 0 – Cameleon