帝国cms留言板增加自定义字段教程
来源:百度文库 编辑:神马文学网 时间:2024/06/13 09:35:38
先发一个效果图,大家可以看看,如果是想要的效果,就接着往下看,如果不需要这种效果就不要浪费各位的时间啦,呵呵,还有这个教程也是从其它地方借签的,然后自己动手做出来的,呵呵
效果参考页面:http://www.wangchuang8.com/e/tool/gbook/?bid=1
开始操作:
注:我在数据库中增加的字段一共有下面几个:ZD_web,ZD_fax,ZD_add,ZD_company,ZD_fangsi,ZD_zhengzhuang,ZD_fuwu
一、在数据库中增加字段。
如果会php程序,而且知道数据库前缀的可以直接在后台的"系统设置"里面"执行sql语句"来建立表字段ZD_web,ZD_fax,ZD_add,ZD_company,ZD_fangsi,ZD_zhengzhuang,ZD_fuwu,因为我对php不熟,而且sql也只会一点点,所以我就用帝国带的"phpmyadmin"来修改数据库
点击左边的wangchuang_enewsgbook 这个表
在这里输入要建立字段的数量,然后执行,这里省下建立字段的图片,如果还是不明白的可以加我QQ:723861002
二、打开e/tool/gbook/下面的index.php文件,在大约50左右的位置找下面这段代码:
$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内的替换掉:
三、打开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="".$r['username']."";
}
?>
}
?>
好了,把这个文件保存,上传就OK了,
最后看一下后台的效果图:
如果你实在不想动手去改的话,就把rar内的文件直接上传上去吧,呵呵,把e/下面的这些文件覆盖就可以了,覆盖前请记得备份原文件哟,特别是改动过模板的朋友,别把自己的模板改掉了到时候要重新弄,那就麻烦大了,可呵
效果参考页面:http://www.wangchuang8.com/e/tool/gbook/?bid=1
开始操作:
注:我在数据库中增加的字段一共有下面几个:ZD_web,ZD_fax,ZD_add,ZD_company,ZD_fangsi,ZD_zhengzhuang,ZD_fuwu
一、在数据库中增加字段。
如果会php程序,而且知道数据库前缀的可以直接在后台的"系统设置"里面"执行sql语句"来建立表字段ZD_web,ZD_fax,ZD_add,ZD_company,ZD_fangsi,ZD_zhengzhuang,ZD_fuwu,因为我对php不熟,而且sql也只会一点点,所以我就用帝国带的"phpmyadmin"来修改数据库
点击左边的wangchuang_enewsgbook 这个表
在这里输入要建立字段的数量,然后执行,这里省下建立字段的图片,如果还是不明白的可以加我QQ:723861002
二、打开e/tool/gbook/下面的index.php文件,在大约50左右的位置找下面这段代码:
$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内的替换掉:
请您留言: | |
网站域名: | * |
您的姓名: | * |
电 话: | |
电子邮箱: | |
传 真: | |
通讯地址: | |
公司名称: | |
报告接收方式: | 传真 |
网站的症状: | 无流量 无排名 无收益 |
后续服务: | 网站优化 网站改版 |
其他问题或意见(*): | |
三、打开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="".$r['username']."";
}
?>
发布者: =$r[ZD_company]?> ( =$r[name]?> ) | 发布时间: =$r[lytime]?> (IP: =$r[ip]?>) | ||
| |||
}
?>
分页: =$returnpage?> |
好了,把这个文件保存,上传就OK了,
最后看一下后台的效果图:
如果你实在不想动手去改的话,就把rar内的文件直接上传上去吧,呵呵,把e/下面的这些文件覆盖就可以了,覆盖前请记得备份原文件哟,特别是改动过模板的朋友,别把自己的模板改掉了到时候要重新弄,那就麻烦大了,可呵
帝国cms留言板增加自定义字段教程
帝国cms留言板增加自定义字段教程 帝国cms - 安全、强大、稳定、灵活
建站教程>CMS建站>如何在帝国cms留言板显示IP
帝国Cms教程-帝国CMS为什么页面不统计访问数呢?-帝国CMS
帝国 cms采集规则使用图文教程
帝国Cms教程-全站域名更换说明-帝国CMS教程
建站教程>CMS建站>帝国CMS系统提示页修改地点-中国西部旅游信息网
建站教程>CMS建站>帝国CMS核心文件简要描述
建站教程>CMS建站>帝国CMS教你怎么写搜索功能
建站教程>CMS建站>帝国CMS分类信息内容页显示ip问题
建站教程>CMS建站>帝国cms采集分页规则几种写法
建站教程>CMS建站>帝国CMS讲解环绕广告的实现方法
建站教程>CMS建站>帝国cms灵动标签应用大汇总
建站教程>CMS建站>帝国cms分类信息电话号码查询
建站教程>CMS建站>帝国cms6.0多搜素表单教程
建站教程>CMS建站>帝国cms分页采集正则及过滤技巧-中国西部旅游信息网
建站教程>CMS建站>帝国CMS会员通过推荐点击链接获得点数-中国西部旅游信息网
建站教程>CMS建站>帝国cms首页调用已注册会员人数和最新会员名称
五步让你的帝国拥有三级联动下拉菜单[超详细教程] 帝国cms - 安全、强大、稳定、灵活
帝国cms采集常用技巧
帝国cms采集实例教程(3)
建站教程>CMS建站>帝国CMS灵动标签技巧,多少天内的信息显示new字样-中国西部旅游信...
自定义指标编写教程
自定义指标编写教程