Ecshop一些比较常用的标签函数分享

2015-6-11 / 0 评论 / 20376 阅读

限制某个参数调用的数量:

<!-- {if $smarty.foreach.参数.index lt 数量}-->代码<!-- {/if} -->



控制当某个参数少于多少时的显示方式:

<!-- {if $smarty.foreach.参数.iteration<数量}-->代码<!-- {/if} -->



以上的参数函数如下(提供部分):

排行榜:top_goods

热门商品:hot_goods

精品推荐:best_goods

新品上市:new_goods

分类商品:cat_goods

最新文章:new_articles



举例:

<!-- {foreach name=top_goods from=$top_goods item=goods}-->

<!-- {if $smarty.foreach.top_goods.iteration<3}--><ul class="topcp_tp"><li><a href="{$goods.url}"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}" class="samllimg" /></a></li></ul><!-- {/if} -->

<!-- {if $smarty.foreach.top_goods.iteration>3}--><ul class="topcp_wz"><li><a href="{$goods.url}" title="{$goods.name|escape:html}">{$goods.short_name}</a></li></ul><!-- {/if} -->

<!-- {/foreach} -->

评论一下?

OωO
取消