人人人妻人人人妻人人人,99精品国产综合久久久久五月天 ,欧美白人最猛性XXXXX,日韩AV无码免费播放

News新聞

業(yè)界新聞動(dòng)態(tài)、技術(shù)前沿
Who are we?

您的位置:首頁(yè)      樂(lè)道系統(tǒng)FAQ      Smarty中foreach的index、iteration,@count的使用

Smarty中foreach的index、iteration,@count的使用

標(biāo)簽: 發(fā)布日期:2014-02-20 00:00:00 891

{{if $a|@count neq 0}} //smarty調(diào)用php內(nèi)置函數(shù) 前面加@  ,等同于{{if count($a)!=0}}

 
{{/if}}

index包含當(dāng)前數(shù)組索引,從零開(kāi)始。

index示例

{* The header block is output every five rows *}
{* 每五行輸出一次頭部區(qū)塊 *}
<table>
{foreach from=$items key=myId item=i name=foo}
   {if $smarty.foreach.foo.index % 5 == 0}
      <tr><th>Title</th></tr>
   {/if}
   <tr><td>{$i.label}</td></tr>
{/foreach}
</table>

.iteration包含當(dāng)前循環(huán)次數(shù),與index不同,從1開(kāi)始,每次循環(huán)增長(zhǎng)1。

iteration和index示例

{* this will output 0|1, 1|2, 2|3, ... etc *}
{* 該例將輸出0|1, 1|2, 2|3, ... 等等 *}