ecshop首页调用指定商品分类下商品数量循环和css循环使用说明
商城首页调用指定商品分类下商品数量循环和css循环使用说明
<!--{foreach from=$jcw_chajian_hot_goods_1 item=goods name=no}--> 调用ID
{if $smarty.foreach.no.iteration < 8} 控制商品显示数量
<li class="ecshop{$smarty.foreach.no.iteration}"> CSS循环 比如数量是 6个 CSS 效果是:ecshop1 ecshop2----ecshop6
<span class="number">{$smarty.foreach.no.iteration}</span> 循环数量显示
<h4>{$goods.name|truncate:20}</h4>控制商品名称 长度
{/if}
<!--{/foreach}-->
效果如下
举例2:
<?php
$children3 = get_children($GLOBALS['smarty']->_var['goods_cat']['id']);
$GLOBALS['smarty']->assign('hotGoods3', get_category_recommend_goods('hot', $children3));
?>
<dl id="con_goods1_1" style=" display:block">
<!--{foreach from=$hotGoods3 item=goods name=name}-->
{if $smarty.foreach.name.iteration < 6}
<ul class="ECSHOP show_fang_box">
<span>{$smarty.foreach.name.iteration}</span>
<li class="img"><a href="{$goods.url}" target="_blank" title="{$goods.name|escape:html}"><img src="{$goods.thumb}" width="60" height="60" alt="{$goods.name|escape:html}" /></a></li>
<li>
<a href="{$goods.url}" target="_blank" title="{$goods.name|escape:html}">{$goods.name|truncate:20}</a><br>
<font class="f1">
<!-- {if $goods.promote_price neq ""} -->
{$goods.promote_price}
<!-- {else}-->
{$goods.shop_price}
<!--{/if}-->
</font>
</li>
</ul>
{/if}
<!--{/foreach}-->
</dl>
文章转载:http://www.gehut.cn/