Smarty 限制foreach的循环次数

<!--{foreach from=$news item=news name=foo}-->  
    <!--{if $smarty.foreach.foo.index <7}-->//循环$news中的前7条内容  
        <a  href="#"><!--{$news.content_title}--></a>   
    <!--{/if}-->  
<!--{/foreach}-->  


 

posted @ 2013-08-28 07:44  moqiang02  阅读(176)  评论(0编辑  收藏  举报