例如
{list action=module catid=$catid isflag=0 page=1}
xxx
{/list}
如果當(dāng)前調(diào)用的欄目類別沒有數(shù)據(jù),我希望顯示'沒有數(shù)據(jù)'
我嘗試這樣
{list action=module catid=$catid isflag=0 page=1}
{if $t}
xxx
{else}
沒有數(shù)據(jù)
{/if}
{/list}
但是不對(duì)啊
另外如果我想在最后一條數(shù)據(jù)下加個(gè)‘結(jié)束了’
如何判斷輸出的數(shù)據(jù)是最后一條數(shù)據(jù)
盼請(qǐng)教
{list action=module catid=$catid isflag=0 page=1}
xxx
{/list}
{if !$count}
沒有數(shù)據(jù)
{/if}
【接單二開】1樓
感謝! 又學(xué)到一招
那如何判斷輸出的數(shù)據(jù)是最后一條呢
{$total} 是總數(shù) 利用$key 來判斷即可 {if ($key-1) == $total } 這里是最后一條 {/if} 注意下 $key 輸出的是1開始還是0開始最后 說下 你最后一條 需要判斷么? 你直接在list外面加一個(gè) 已結(jié)束不就好了 反正都是輸出最后一條不循環(huán)了
明白了
換個(gè)思路 如果我希望每4條數(shù)據(jù)夾一個(gè)條廣告可以利用這個(gè)key
{list action=module catid=$catid isflag=0 page=1}
{list action=module catid=$catid isflag=0 page=1} {$t.title} {if $key%4==0} 廣告 {/if} {/list}這樣是吧