本文目錄
- 自定義評(píng)論字段基本步驟
- ·舉例說明:制作“簡單的餐館評(píng)分”
為了適應(yīng)不同欄目不同需求的評(píng)論,帝國CMS引入了多評(píng)論列表模板后,還引入了評(píng)論自定義字段,支持不同欄目不同評(píng)論樣式與選項(xiàng)。
自定義評(píng)論字段基本步驟
1、增加評(píng)論表單所需字段。
2、修改評(píng)論模板加上字段表單元素及字段顯示變量。
3、完成。
·舉例說明:制作“簡單的餐館評(píng)分”
1、增加評(píng)論表單所需字段:
經(jīng)過分析我們需要的字段如下:(字段標(biāo)識(shí):字段名)
口味評(píng)分:kwpf
服務(wù)評(píng)分:fwpf
環(huán)境評(píng)分:hjpf
性價(jià)評(píng)分:xjpf
增加字段步驟:
(1)、后臺(tái)>"評(píng)論管理">"自定義評(píng)論字段">"增加字段",進(jìn)入如下界面增加字段:
因?yàn)樵u(píng)分為數(shù)字1~5所以字段類型用TINYINT(1)就可以,上面為口味評(píng)論字段設(shè)置,其他三個(gè)字段設(shè)置也一樣,改下字段名就行。
(2)、增加所有字段后,返回管理評(píng)論自定義字段就能看到增加的字段,如下圖:
2、修改評(píng)論模板加上字段表單元素及字段顯示變量:
(1)、后臺(tái)>"模板管理">"管理評(píng)論模板">修改,進(jìn)入評(píng)論模板修改界面:
(2)、將模板復(fù)制到Dreamweaver修改:
在評(píng)論表單模板加上字段表單元素顯示,例如:(name=字段名)
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="11%" height="23">
<div align="center"><strong>口味:</strong>
<input type="radio" name="kwpf" value="1">一星
<input type="radio" name="kwpf" value="2">二星
<input type="radio" name="kwpf" value="3" checked>三星
<input type="radio" name="kwpf" value="4">四星
<input type="radio" name="kwpf" value="5">五星
</div></td>
</tr>
<tr>
<td height="23">
<div align="center"><strong>服務(wù):</strong>
<input type="radio" name="fwpf" value="1">一星
<input type="radio" name="fwpf" value="2">二星
<input type="radio" name="fwpf" value="3" checked>三星
<input type="radio" name="fwpf" value="4">四星
<input type="radio" name="fwpf" value="5">五星
</div></td>
</tr>
<tr>
<td height="23">
<div align="center"><strong>環(huán)境:</strong>
<input type="radio" name="hjpf" value="1">一星
<input type="radio" name="hjpf" value="2">二星
<input type="radio" name="hjpf" value="3" checked>三星
<input type="radio" name="hjpf" value="4">四星
<input type="radio" name="hjpf" value="5">五星
</div></td>
</tr>
<tr>
<td height="23">
<div align="center"><strong>性價(jià):</strong>
<input type="radio" name="xjpf" value="1">一星
<input type="radio" name="xjpf" value="2">二星
<input type="radio" name="xjpf" value="3" checked>三星
<input type="radio" name="xjpf" value="4">四星
<input type="radio" name="xjpf" value="5">五星
</div></td>
</tr>
</table>
顯示評(píng)分字段的地方加:([!–字段名–])
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="50%" height="23"><strong>口味:</strong><img src="[!--news.url--]e/data/images/[!--kwpf--]star.gif" border="0" align="absmiddle"></td>
<td height="23"><strong>服務(wù):<img src="[!--news.url--]e/data/images/[!--fwpf--]star.gif" border="0" align="absmiddle"></strong></td>
</tr>
<tr>
<td height="23"><strong>環(huán)境:<img src="[!--news.url--]e/data/images/[!--hjpf--]star.gif" border="0" align="absmiddle"></strong></td>
<td height="23"><strong>性價(jià):<img src="[!--news.url--]e/data/images/[!--xjpf--]star.gif" border="0" align="absmiddle"></strong></td>
</tr>
</table>
修改模板后將模板代碼復(fù)制到后臺(tái)模板處,然后點(diǎn)擊修改即可。
3、至此,“簡單的餐館評(píng)分”制作完畢,效果如下:
總結(jié):
首先后臺(tái)增加評(píng)論字段,然后修改評(píng)論模板即可:評(píng)論表單元素可任意,只需變量“name=字段名”,顯示評(píng)論字段內(nèi)容用“[!–字段名–]”。
更多帝國CMS 6.0解密請(qǐng)聽下回分解。