新聞中心
DEDECMS模板制作基礎(chǔ):Channel頻道標(biāo)簽介紹
作者 / 無憂主機(jī) 時間 2012-08-08 12:28:54
channel是織夢常用標(biāo)記之一,這是我們在制作dedecms模版的時候經(jīng)常用channel標(biāo)簽獲取頻道列表制作導(dǎo)航條,我們看到的網(wǎng)站導(dǎo)航欄都是用這個標(biāo)簽實現(xiàn),在配合文章表情,基本上一個板塊頁面就基本成型了。所以,練習(xí)開發(fā)dedecms模板的時候,對模板的結(jié)構(gòu)必須要有一個清晰的認(rèn)識。下面無憂主機(jī)(m.love62.cn)小編詳細(xì)講解下channel標(biāo)簽的使用方法。 channel標(biāo)簽基本的語法是:
{dede:channel type='top' row='8' currentstyle="<li> <a href='~typelink~' class='thisclass'>~typename~</a> </li>} <li><a href='[field:typelink/]'>[field:typename/]</a> </li>語法參數(shù)分解說明: 1、row ='數(shù)字' 表示獲取記錄的條數(shù)(通用在某級欄目太多的時候使用,默認(rèn)是 8) 2、type =top,sun/son/self(top表示頂級欄目、son和sun表示下級欄目、self表示同級欄目) 3、currentstyle="表示應(yīng)用樣式 channel標(biāo)簽在底層模版中的參數(shù)說明: 其中后兩個屬性必須在列表模板(list_)中使用。常用的底層模板變量有: typename,typedir,typelink(僅表示欄目的網(wǎng)址) 完整的寫法如下:
{dede:channel type=’top’} <a href=’[field:typelink/]’>[field:typename/]</a> {/dede:channel}把以上標(biāo)簽代碼加入到首頁模板中(index.htm),然后在后臺生成一個首頁html,可以看到如下面的效果(效果有點丑,僅僅為了驗證和輸出樣式。
![image001](http://m.love62.cn/wp-content/uploads/2012/08/image0016-150x150.png)
本文地址:http://m.love62.cn/dedecms/7163.html
![1](/wp-content/themes/starow_z/img/o-1.png)
![1](/wp-content/themes/starow_z/img/o-2.png)
![1](/wp-content/themes/starow_z/img/o-3.png)
![1](/wp-content/themes/starow_z/img/o-4.png)
![1](/wp-content/themes/starow_z/img/o-5.png)
![1](/wp-content/themes/starow_z/img/o-6.png)
![1](/wp-content/themes/starow_z/img/o-7.png)