ecshop foreach 中怎么判断3次
<divclass="1"></div><divclass="2"></div><divclass="3"></div><divclass="1"></div><divc...
<div class="1"></div>
<div class="2"></div>
<div class="3"></div>
<div class="1"></div>
<div class="2"></div>
<div class="3"></div>
<div class="1"></div>
<div class="2"></div>
<div class="3"></div>
这样子怎么用foreach 循环? 展开
<div class="2"></div>
<div class="3"></div>
<div class="1"></div>
<div class="2"></div>
<div class="3"></div>
<div class="1"></div>
<div class="2"></div>
<div class="3"></div>
这样子怎么用foreach 循环? 展开
展开全部
{foreach from=$items key=myId item=i name=foo}
{if $smarty.foreach.foo.iteration %3 ==1}
<div class="1"></div>
{elseif $smarty.foreach.foo.iteration %3 ==2}
<div class="2"></div>
{elseif $smarty.foreach.foo.iteration %3 ==3}
<div class="3"></div>
{/if}
{/foreach}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询