这个是最简洁的办法,也是最可靠的办法,比网上搜索来的方法快捷多了,修改也简单,好模板提供,转载请注明网址
<?php
$this->assign('top_goods_1' , get_top10(12));//分类12
?>
<!-- {foreach name=top_goods from=$top_goods_1 item=goods}-->
<!-- {if $smarty.foreach.top_goods.iteration<2}-->
<LI class=fore><SPAN>{$smarty.foreach.top_goods.iteration}</SPAN>
<DIV class=p-img><a href="{$goods.url}"><IMG height=50 src="{$goods.thumb}" alt="{$goods.goods_name|escape:html}" width=50></A></DIV>
<DIV class=p-name><a href="{$goods.url}" title="{$goods.goods_name|escape:html}">{$goods.goods_name}</A></DIV>
<DIV class=p-price><STRONG>{$goods.price}</STRONG></DIV></LI>
<!-- {/if} -->
<!-- {if $smarty.foreach.top_goods.iteration>1}-->
<LI><SPAN>{$smarty.foreach.top_goods.iteration}</SPAN>
<DIV class=p-name><a href="{$goods.url}" title="{$goods.goods_name|escape:html}">{$goods.goods_name}</A></DIV></LI>
<!-- {/if} -->
<!--{/foreach}-->
(责任编辑:好模板) |