Emlog给文章批评表单只提供了四个默许字段,离别是昵称、邮箱、网址以及批评内容,只能满足平常 博客网站的需求,假如想要增添更多的批评字段怎么办?能够经由过程Emlog批评自定义字段完成,类似于文章的自定义字段功用,对应数据表是 emlog_comment到场对应的字段即可。
以字段simi为例:在数据库 emlog_comment中到场字段simi(可自定义,不能与原有字段雷同,与下面的参数要一致);温馨提醒:。假如是增添复选框,字段参数范例请挑选[ enum ],字符长度平常是'n','y',默许值要么是n 要么是y。两种范例分类可离别参考字段增加请和 emlog_comment中poster参数与hide参数
关于input中type申明
checkbox:定义复选框
radio:定义单选按钮
txt:定义单行的输入字段,用户可在个中输入文本。默许宽度为 20 个字符。
前端批评框操作要领步骤
1、在模板文件module.php中找到批评框代码,找到适宜的位置到场代码
<label><input type="checkbox" value="y" id="simi" name="simi" ><font color="red">私密(仅管理员可见)</font></label>2、在include/model/comment_model.php文件中找到
function addComment($name, $content, $mail, $url, $imgcode, $blogId, $pid) 用下面代码替代function addComment($name, $content, $mail, $url, $imgcode, $blogId, $pid, $simi)找到$hide = ROLE == ROLE_VISITOR ? $ischkcomment : 'n';背面到场代码$simi = isset($_POST['simi']) ? $_POST['simi'] : 'n';找到代码$sql = 'INSERT INTO '.DB_PREFIX."comment (date,poster,gid,comment,mail,url,hide,ip,pid) VALUES ('$utctimestamp','$name','$blogId','$content','$mail','$url','$hide','$ipaddr','$pid')";用下面代码替代$sql = 'INSERT INTO '.DB_PREFIX."comment (date,poster,gid,comment,mail,url,hide,ip,pid,simi) VALUES ('$utctimestamp','$name','$blogId','$content','$mail','$url','$hide','$ipaddr','$pid','$simi')";
找到function replyComment($blogId, $pid, $content, $hide) 用下面代码替代function replyComment($blogId, $pid, $content, $hide, $simi)找到$hide = ROLE == ROLE_VISITOR ? $ischkcomment : 'n';背面到场代码$simi = isset($_POST['simi']) ? $_POST['simi'] : 'n';找到$this->db->query("INSERT INTO ".DB_PREFIX."comment (date,poster,gid,comment,mail,url,hide,ip,pid)VALUES ('$utctimestamp','$name','$blogId','$content','$mail','$url','$hide','$ipaddr','$pid')");用下面代码替代$this->db->query("INSERT INTO ".DB_PREFIX."comment (date,poster,gid,comment,mail,url,hide,ip,pid,simi)VALUES ('$utctimestamp','$name','$blogId','$content','$mail','$url','$hide','$ipaddr','$pid','$simi')");批评列表挪用要领
<?php if($comment['simi']=='y'){echo '<font color="red">私密(仅管理员可见)</font>';}else{echo $comment['content'];}?>
侧边栏最新批评操作要领步骤 在根目录include/lib/cache.php中找到'mail' => $show_com['mail'],背面到场代码'simi' => $show_com['simi'],挪用要领
<?php echo $value['content'];?>用下面代码替代<?php if($value['simi']=='y'){?><font color="red">私密(仅管理员可见)</font><?php }else{echo $value['content'];}?>
以上要领为前端方面的教程,若有疑问,可在本页留言征询。
背景编辑时变动的操作要领教程
1、在根目录文件admin/comment.php中找到$url = isset($_POST['url']) ? addslashes(trim($_POST['url'])) : '';背面增加下面代码$simi = isset($_POST['simi']) ? addslashes(trim($_POST['simi'])) : 'n';找到'url' => $url,背面增加下面代码'simi' => $simi,2、在admin/views/comment_edit.php及comment_reply.php文件<form></form>之间恣意位置安排以下代码
<li><input type="checkbox" name="simi" value="y"<?php if($simi=='y'){echo ' checked="checked"';}?>><font color="red">仅管理员可检察</font></li>

评论列表