一、作用
循環(huán)顯示出模塊所有可用模塊信息
二、語法
{list action=cache name=module ....}{/list}
簡寫(3.2.19以上版本支持):{cache name=module ....}{/cache }
三、參數(shù)介紹(紅色表示必填參數(shù),藍色表示系統(tǒng)默認參數(shù))
| 參數(shù) | 介紹 |
|---|---|
| action | cache |
| name | module |
| site | 站點id,默認當前站點,填寫其他站點id表示查詢其他站點的模塊數(shù)據(jù) |
| return | 默認返回變量為t,調用方式就是{$t.字段值}(多級list查詢必須設置return=其他字母,否則你懂得) |
四、返回變量
| 變量 | 參數(shù) |
|---|---|
| {$error} | 當查詢不到數(shù)據(jù)時,會返回錯誤信息,調試模板時很有用哦(寫在list標簽以外) |
| {$count} | 當前查詢的記錄,當存在分頁時,表示當前頁的記錄數(shù)(寫在list標簽以外) |
| {$key} | 當前記錄指針位置,從0開始(寫在list標簽以內) |
| 當存在return=字母時,以上變量都要寫成這種格式{$變量_字母},例如{list ...reutrn=a}時,變量格式{$key_a} | |
| {$is_first} | 判斷是否第一條,{if $is_first}第一條{/if} |
| {$is_last} | 判斷是否最后一條,{if $is_last}最后一條{/if} |
五、相關例子
1、顯示當前站點可用模塊數(shù)據(jù)
{list action=cache name=module}
模塊地址:{$t.url}
模塊名稱:{$t.name}
模塊目錄:{$t.dirname}
{/list}
{$error} // 錯誤信息2、顯示指定站點1的可用模塊數(shù)據(jù)
{list action=cache name=module site=1}
模塊地址:{$t.url}
模塊名稱:{$t.name}
模塊目錄:{$t.dirname}
{/list}
{$error} // 錯誤信息
文檔最后更新時間:2018-09-29 08:28:43