王尘宇王尘宇

研究百度干SEO做推广变成一个被互联网搞的人

Emlog文章页到场新的参数并写入数据库

给 emlog 博客程序到场新的字段,要领很简单的,不过有点庞杂,假如弄不明白, 发起你购置《 Emlog宣布时文章自定义参数插件》一键搞定,下面我们一步一步来完成手动加字段,首先在数据表 emlog_blog中到场新的字段“sheli01”,参数中的“sheli01”能够自行修正,一定要一致,不然无效。

第一步:在根目录文件admin/views/add_log.php对应的位置到场你要的参数代码,比方:

<div style="clear:both;">参数一:<input type="text" value="" name="sheli01" id="sheli01" style="width:750px;" /></div>

第二步:在根目录文件admin/views/edit_log.php中对应的位置也到场你要的参数代码,比方:

<div style="clear:both;">参数一:<input type="text" value="<?php echo $sheli01;?>" name="sheli01" id="sheli01" style="width:750px;" /></div>

第三步:在根目录文件admin/save_log.php中

$password = isset($_POST['password']) ? addslashes(trim($_POST['password'])) : '';下面插进去代码$sheli01= isset($_POST['sheli01']) ? addslashes(trim($_POST['sheli01'])) : '';

'password' => $password,下面插进去代码'sheli01' => $sheli01,

第四步:在根目录文件include/model/log_model.php中,没有这一步前台将没法显现

'password' => $row['password'],下面插进去'sheli01' => $row['sheli01'],


前台直接挪用:<?php echo $sheli01;?>
  以上步骤悉数完成就能够完成增加参数了,不过美中不足的是只要点击《保留并返回》才保留。如想完成点击《保留》也能完成保留的话,请按下面的要领,找到根目录admin/views/js/common.js中找到

editorMap['content'].sync();    editorMap['excerpt'].sync();var url = "save_log.php?action=autosave";var title = $.trim($("#title").val());var alias = $.trim($("#alias").val());var sort = $.trim($("#sort").val());var postdate = $.trim($("#postdate").val());var date = $.trim($("#date").val());var logid = $("#as_logid").val();var author = $("#author").val();var content = $('#content').val();var excerpt = $('#excerpt').val();var tag = $.trim($("#tag").val());var top = $("#post_options #top").attr("checked") == 'checked' ? 'y' : 'n';var sortop = $("#post_options #sortop").attr("checked") == 'checked' ? 'y' : 'n';var allow_remark = $("#post_options #allow_remark").attr("checked") == 'checked' ? 'y' : 'n';var allow_tb = $("#post_options #allow_tb").attr("checked") == 'checked' ? 'y' : 'n';var password = $.trim($("#password").val());var ishide = $.trim($("#ishide").val());        var token = $.trim($("#token").val());var ishide = ishide == "" ? "y" : ishide;var querystr = "content="+encodeURIComponent(content)+"&excerpt="+encodeURIComponent(excerpt)+"&title="+encodeURIComponent(title)+"&alias="+encodeURIComponent(alias)+"&author="+author+"&sort="+sort+"&postdate="+postdate+"&date="+date+"&tag="+encodeURIComponent(tag)+"&top="+top+"&sortop="+sortop+"&allow_remark="+allow_remark+"&allow_tb="+allow_tb+"&password="+password                    +"&token="+token+"&ishide="+ishide+"&as_logid="+logid;

用下面的代码替代

editorMap['content'].sync();    editorMap['excerpt'].sync();var url = "save_log.php?action=autosave";var title = $.trim($("#title").val());var alias = $.trim($("#alias").val());var sort = $.trim($("#sort").val());var postdate = $.trim($("#postdate").val());var date = $.trim($("#date").val());var logid = $("#as_logid").val();var author = $("#author").val();var content = $('#content').val();var excerpt = $('#excerpt').val();var tag = $.trim($("#tag").val());var top = $("#post_options #top").attr("checked") == 'checked' ? 'y' : 'n';var sortop = $("#post_options #sortop").attr("checked") == 'checked' ? 'y' : 'n';var allow_remark = $("#post_options #allow_remark").attr("checked") == 'checked' ? 'y' : 'n';var allow_tb = $("#post_options #allow_tb").attr("checked") == 'checked' ? 'y' : 'n';var password = $.trim($("#password").val());var sheli01 = $.trim($("#sheli01").val()); //新加代码var ishide = $.trim($("#ishide").val());        var token = $.trim($("#token").val());var ishide = ishide == "" ? "y" : ishide;var querystr = "content="+encodeURIComponent(content)+"&excerpt="+encodeURIComponent(excerpt)+"&title="+encodeURIComponent(title)+"&alias="+encodeURIComponent(alias)+"&author="+author+"&sort="+sort+"&postdate="+postdate+"&date="+date+"&tag="+encodeURIComponent(tag)+"&top="+top+"&sortop="+sortop+"&allow_remark="+allow_remark+"&allow_tb="+allow_tb+"&password="+password+"&sheli01="+sheli01 //新加代码                    +"&token="+token+"&ishide="+ishide+"&as_logid="+logid;

着手尝尝吧,若有疑问,请在本页留言。
  还不会的朋侪,能够直接购置《 Emlog宣布时文章自定义参数插件》

相关文章

评论列表

发表评论:
验证码

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。