优晟SEO

您现在的位置是:首页 > CMS教程 > 帝国cms > 正文

帝国cms

帝国模板留言板增加自定义字段教程

佚名 2024-08-20帝国cms
以下是详细的添加方法注:我在数据库中增加的字段一共有下面几个:ZD_web,ZD_fax,ZD_add,ZD_company,ZD_fangsi,ZD_zhengzhuang,ZD_fuwu.$query="select lyid,name,email,`call`,lytime,lytext,retext from {$dbtbpre}ene……

帝国模板留言板增加自定义字段教程

以下是详细的添加方法

注:我在数据库中增加的字段一共有下面几个:ZD_web,ZD_fax,ZD_add,ZD_company,ZD_fangsi,ZD_zhengzhuang,ZD_fuwu.

$query="select lyid,name,email,`call`,lytime,lytext,retext from {$dbtbpre}enewsgbook where bid='$bid' and checked=0";

替换成

$query="select lyid,name,email,`call`,lytime,lytext,retext,ZD_web,ZD_fax,ZD_add,ZD_company,ZD_fangsi,ZD_zhengzhuang,ZD_fuwu from {$dbtbpre}enewsgbook where bid='$bid' and checked=0";

下面这段是加在form内的,把原form内的替换掉:

<table width="92%" border="0" align="center" cellpadding="4" cellspacing="1"class="tableborder">                            <tr class="header">                              <td colspan="2" bgcolor="#F4F9FD"><strong>请您留言:</strong></td>                            </tr>                            <tr bgcolor="#FFFFFF">                              <td width="20%">网站域名:</td>                              <td width="722" height="23"><input name="ZD_web" type="text" id="ZD_web" />                                *</td>                            </tr>                            <tr bgcolor="#FFFFFF">                              <td>您的姓名:</td>                              <td height="23"><input name="name" type="text" id="name" />                                *</td>                            </tr>                            <tr bgcolor="#FFFFFF">                              <td>电 话:</td>                              <td height="11"><input name="call" type="text" id="call" /></td>                            </tr>                            <tr bgcolor="#FFFFFF">                              <td>电子邮箱:</td>                              <td height="-2"><input name="email" type="text" id="email" /></td>                            </tr>                            <tr bgcolor="#FFFFFF">                              <td>传 真:</td>                              <td height="-1"><input name="ZD_fax" type="text" id="ZD_fax" /></td>                            </tr>                            <tr bgcolor="#FFFFFF">                              <td>通讯地址:</td>                              <td height="0"><input name="ZD_add" type="text" id="ZD_add" /></td>                            </tr>                            <tr bgcolor="#FFFFFF">                              <td>公司名称:</td>                              <td height="0"><input name="ZD_company" type="text" id="ZD_company" /></td>                            </tr>                            <tr bgcolor="#FFFFFF">                              <td>报告接收方式:</td>                              <td height="1"><input id="radio" value="传真" type="radio" name="ZD_fangsi" />                                传真                                <label>                      <input id="radio2" value="电子邮件" checked="checked" type="radio" name="ZD_fangsi" />                                  电子邮件 </label></td>                            </tr>                            <tr bgcolor="#FFFFFF">                              <td>网站的症状:</td>                              <td height="2"><input id="ZD_zhengzhuang" value="无流量" type="checkbox" name="ZD_zhengzhuang" />                                无流量                                <input id="ZD_zhengzhuang" value="无排名" type="checkbox" name="ZD_zhengzhuang" />                                无排名                                <input id="ZD_zhengzhuang" value="无收益" type="checkbox" name="ZD_zhengzhuang" />                                无收益</td>                            </tr>                            <tr bgcolor="#FFFFFF">                              <td>后续服务: </td>                              <td height="5"><input id="ZD_fuwu" value="网站优化" type="checkbox" name="ZD_fuwu" />                                网站优化                                <input id="ZD_fuwu" value="网站改版" type="checkbox" name="ZD_fuwu" />                                网站改版</td>                            </tr>                            <tr bgcolor="#FFFFFF">                              <td>其他问题或意见(*):</td>                              <td height="23"><textarea name="lytext" cols="60" rows="12" id="lytext"></textarea></td>                            </tr>                            <tr bgcolor="#FFFFFF">                              <td height="23">&nbsp;</td>                              <td height="23"><input type="submit" name="Submit3" value="提交" />                                  <input name="bid" type="hidden" value="1" />                                  <input type="reset" name="Submit22" value="重置" />                                  <input name="enews" type="hidden" id="enews" value="AddGbook" /></td>                            </tr>                          </table>

三、打开e/gbook/enews/下面的gbookfun.php文件,在大约12行左右的地方找到以下代码

        $name=RepPostStr(trim($add[name]));        $email=RepPostStr($add[email]);        $call=RepPostStr($add[call]);

插入下面的代码:

   $ZD_web=RepPostStr($add[ZD_web]);        $ZD_fax=RepPostStr($add[ZD_fax]);        $ZD_add=RepPostStr($add[ZD_add]);        $ZD_company=RepPostStr($add[ZD_company]);        $ZD_fangsi=RepPostStr($add[ZD_fangsi]);        $ZD_zhengzhuang=RepPostStr($add[ZD_zhengzhuang]);        $ZD_fuwu=RepPostStr($add[ZD_fuwu]);

该文件的大约63行找到下面的代码:

        $sql=$empire->query("insert into {$dbtbpre}enewsgbook(name,email,`call`,lytime,lytext,retext,bid,ip,checked,userid,username,) values('$name','$email','$call','$lytime','$lytext','','$bid','$ip','$br[checked]','$userid','$username');");

替换为:

        $sql=$empire->query("insert into {$dbtbpre}enewsgbook(name,email,`call`,lytime,lytext,retext,bid,ip,checked,userid,username,ZD_web,ZD_fax,ZD_add,ZD_company,ZD_fangsi,ZD_zhengzhuang,ZD_fuwu) values('$name','$email','$call','$lytime','$lytext','','$bid','$ip','$br[checked]','$userid','$username','$ZD_web','$ZD_fax','$ZD_add','$ZD_company','$ZD_fangsi','$ZD_zhengzhuang','$ZD_fuwu');");

四、打开e/data/template下面的gbooktemp.txt文件,约51号找下面的代码:

$query="select lyid,name,email,`call`,lytime,lytext,retext from {$dbtbpre}enewsgbook where bid='$bid' and checked=0";

替换成:

$query="select lyid,name,email,`call`,lytime,ZD_web,ZD_fax,ZD_add,ZD_company,ZD_fangsi,ZD_zhengzhuang,ZD_fuwu,lytext,retext from {$dbtbpre}enewsgbook where bid='$bid' and checked=0";

五、打开e/class下面的functions.php文件,约2934号的位置找下面代码:

$listtemp_center=str_replace("[!--lyid--]","<?=$r[lyid]?>",$listtemp_center);

插入下面的代码:

 $listtemp_center=str_replace("[!--ZD_web--]","<?=$r[ZD_web]?>",$listtemp_center);        $listtemp_center=str_replace("[!--ZD_fax--]","<?=$r[ZD_fax]?>",$listtemp_center);        $listtemp_center=str_replace("[!--ZD_add--]","<?=$r[ZD_add]?>",$listtemp_center);        $listtemp_center=str_replace("[!--ZD_company--]","<?=$r[ZD_company]?>",$listtemp_center);        $listtemp_center=str_replace("[!--ZD_fangsi--]","<?=$r[ZD_fangsi]?>",$listtemp_center);        $listtemp_center=str_replace("[!--ZD_zhengzhuang--]","<?=$r[ZD_zhengzhuang]?>",$listtemp_center);        $listtemp_center=str_replace("[!--ZD_fuwu--]","<?=$r[ZD_fuwu]?>",$listtemp_center);

六、打开e/class下面的functions.php文件,约2108号的位置找下面代码:

  $listtemp=str_replace("[!--retext--]",nl2br($r['retext']),$listtemp);//回复

插入下面的代码:

        $listtemp=str_replace("[!--ZD_web--]",format_datetime($r['ZD_web'],$formatdate),$listtemp);        $listtemp=str_replace("[!--ZD_fax--]",format_datetime($r['ZD_fax'],$formatdate),$listtemp);        $listtemp=str_replace("[!--ZD_add--]",format_datetime($r['ZD_add'],$formatdate),$listtemp);        $listtemp=str_replace("[!--ZD_company--]",format_datetime($r['ZD_company'],$formatdate),$listtemp);        $listtemp=str_replace("[!--ZD_fangsi--]",format_datetime($r['ZD_fangsi'],$formatdate),$listtemp);        $listtemp=str_replace("[!--ZD_zhengzhuang--]",format_datetime($r['ZD_zhengzhuang'],$formatdate),$listtemp);        $listtemp=str_replace("[!--ZD_fuwu--]",format_datetime($r['ZD_fuwu'],$formatdate),$listtemp);

好了,到这里前台的工作就完成了,把这些文件保存后上传到原路径去,在/e/tool/gbook/?bid=1这个页面提交就可以把数据写入数据库了,最后一步就是后台查看留言的页面,如果后面不改的话,提交的东西在后台看不全的哟,呵呵

七、打开e/admin/tool/下面的gbook.php文件,把form内的代码替换成下面的代码:

<?while($r=$empire->fetch($sql)){$br=$empire->fetch1("select bname from {$dbtbpre}enewsgbookclass where bid='$r[bid]'");//审核$checked="";if($r[checked]){$checked=" title='未审核' style='background:#99C4E3'";}$username="游客";if($r['userid']){        $username="<a href='../member/AddMember.php?enews=EditMember&userid=".$r['userid']."' target=_blank>".$r['username']."</a>";}?><table width="700" border="0" align="center" cellpadding="3" cellspacing="1" class=tableborder>    <tr class=header>       <td width="55%" height="23">发布者:         <span style="word-break:break-all">        <?=$r[ZD_company]?>        </span>        &nbsp;(<span style="word-break:break-all">        <?=$r[name]?>        </span>)</td>        <td width="45%">发布时间:         <?=$r[lytime]?>&nbsp;        (IP:        <?=$r[ip]?>) </td>  </tr>  <tr bgcolor="#FFFFFF">     <td height="23" colspan="2"> <table border=0 width=100% cellspacing=1 cellpadding=10 bgcolor='#cccccc'>        <tr>           <td width='100%' bgcolor='#FFFFFF' style='word-break:break-all'><strong>网站域名:</strong>            <?=$r[ZD_web]?>            <br>            <strong>通讯地址:</strong><?=$r[ZD_add]?><br><strong>报告接收方式:</strong><?=$r[ZD_fangsi]?><br><strong>网站的症状:</strong><?=$r[ZD_zhengzhuang]?><br><strong>后续服务:</strong><?=$r[ZD_fuwu]?><br><strong>其他问题或意见(*):</strong><?=$r[lytext]?></td>        </tr>      </table>      <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">        <tr>           <td><img src="../../data/images/regb.gif" width="18" height="18"><strong><font color="#FF0000">回复:</font></strong>             <?=nl2br($r[retext])?>          </td>        </tr>      </table>     </td>  </tr>  <tr bgcolor="#FFFFFF">    <td height="23" colspan="2"><div align="right">        <table width="100%" border="0" cellspacing="1" cellpadding="3">          <tr>            <td width="65%"><strong>邮箱:<span style="word-break:break-all">              <?=$r[email]?>            </span>,电话:<span style="word-break:break-all">              <?=$r[call]?>            传 真:            <?=$r[ZD_fax]?></span></strong></td>            <td width="35%"> <div align="left"><strong>操作:</strong>[<a href="#ecms" onClick="window.open('ReGbook.php?lyid=<?=$r[lyid]?>&bid=<?=$bid?>','','width=600,height=380,scrollbars=yes');">回复/修改回复</a>]&nbsp;&nbsp;[<a href="gbook.php?enews=DelGbook&lyid=<?=$r[lyid]?>&bid=<?=$bid?>" onClick="return confirm('确认要删除?');">删除</a>]                   <input name="lyid[]" type="checkbox" id="lyid[]" value="<?=$r[lyid]?>"<?=$checked?>>                </div></td>          </tr>        </table>        <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">          <tr>            <td><div align="center">所属留言分类:<a href="gbook.php?bid=<?=$r[bid]?>"><?=$br[bname]?></a></div></td>          </tr>        </table>      </div></td>  </tr></table><br><?}?>  <table width="700" border="0" align="center" cellpadding="3" cellspacing="1">    <tr>       <td>分页:        <?=$returnpage?>        &nbsp;&nbsp;        <input type="submit" name="Submit" value="审核留言" onClick="document.thisform.enews.value='CheckGbook_all';">        &nbsp;&nbsp; <input type="submit" name="Submit2" value="删除留言" onClick="document.thisform.enews.value='DelGbook_all';">        <input name="enews" type="hidden" id="enews" value="DelGbook_all">        <input name="bid" type="hidden" id="bid" value="<?=$bid?>"></td>  </tr></table>

好了,把这个文件保存,上传就OK了,