帝國cms 留言板新增自定義字段
整理了下我的修改步驟(實現留言板增加qq、留言主題字段):
1、進入phpmyadmin后臺,在數據庫enewsgbook表(留言板數據表)中增加字段,
比如: qq、theme,
2、打開e/enews/gbookfun.php,
1、在13行左右的地方插入下面代碼:
$theme=RepPostStr($add[theme]);//myadd
$qq=RepPostStr($add[qq]);//myadd
2、在60行左右找到 $empire->query(“insert into 的語句中的相應的位置加入相應的代碼。
3、打開e/tool/gbook/index.php,
1、在51行左右找到“$query=”select …”查詢語句中適當位置加入字段,如:,theme,qq
2、在135行左右找到“發布者: <?=$r[name]?>……”, 在要顯示字段的地方加入<?=$r[theme]?> ,<?=$r[qq]?> 調用顯示就行了。
3、在170行左右找到“<form action=”../../enews/index.php”” 在表單中加入相應的Input語句就行了。例如在聯系電話這行下面插入:
<tr bgcolor=”#FFFFFF”>
<td>公司名稱:</td>
<td height=”23″><input name=”theme” type=”text” id=”theme” size=”80″/></td>
</tr><!–myadd–>
<tr class=”ly2″>
<td class=”lytxt”>性 別:</td>
<td>
<INPUT name=”qq” value=”先生”> 先生
</td>
</tr><!–myadd–>
4、后臺:打開e/admin/tool/gbook.php,
在50行左右找到“$query=”select”查詢語句,在末尾加入字段:,theme,qq
在119行左右的找到“<table width=”700″ …<td width=”32%” height=”23″>發布者:……”, 在要顯示字段的地方加入“<?=$r[theme]?> ,<?=$r[qq]?>
調用顯示就行了。
5、后臺回復頁面:打開e/admin/tool/ReGbook.php
直接在頁面加入<?=$r[theme]?> ,<?=$r[qq]?>就行了。如在51行左右的“留言發表者”該行下面插入兩行代碼:
<tr bgcolor=”#FFFFFF”>
<td height=”25″>QQ:</td>
<td height=”25″>
<?=$r[qq]?>
</td>
</tr>
<tr bgcolor=”#FFFFFF”>
<td height=”25″>留言主題:</td>
<td height=”25″>
<?=$r[theme]?>
</td>
</tr>
6、到此前、后臺都已經可以了,下面進一步修改:
1、打開e/data/template/gbooktemp.txt文件,約51行找到“$query=”select…”查詢語句,在適當位置加入字段,如:,theme,qq
2、打開e/class/functions.php文件,約2940行找到:“$listtemp_center=str_replace(“[!–retext–]”,”<?=/$r[retext]?>”,$listtemp_center);”,在改
行下面插入相應寫法的代碼,如:
$listtemp_center=str_replace(“[!–theme–]”,”<?=/$r[theme]?>”,$listtemp_center);
$listtemp_center=str_replace(“[!–qq–]”,”<?=/$r[qq]?>”,$listtemp_center);
3、修改下留言板模板就oK了。
到此就搞定了:后臺效果圖如下:
————
總結:
要改的文件有:
e/enews/gbookfun.php
e/tool/gbook/index.php
e/admin/tool/gbook.php
e/admin/tool/ReGbook.php
e/data/template/gbooktemp.txt
e/class/functions.php
新聞熱點
疑難解答