教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 phpweb更换kindeditor编辑器的过程

phpweb更换kindeditor编辑器的过程

发布时间:2016-12-01   编辑:jiaochengji.com
教程集为您提供phpweb更换kindeditor编辑器的过程等资源,欢迎您收藏本站,我们将为您提供最新的phpweb更换kindeditor编辑器的过程资源
KindEditor 是一套开源的在线HTML编辑器,主要用于让用户在网站上获得所见即所得编辑效果,开发人员可以用 KindEditor 把传统的多行文本输入框(textarea)替换为可视化了,下面我们就一起来看看phpweb更换kindeditor编辑器的过程,希望文章可帮助到各位。

都知道phpweb自带的编辑器很不好用,有的时候提交会出现很多问题! 今天开始动工把phpweb的编辑器给换了 首先更换news 模块下的编辑器

1.到kindeditor 官方网站上面下载最新的kindeditor包。
2.删除不用的文件夹,asp,jsp等
3.把kindeditor 的文件夹放入phpweb 根目录下
4.打开news/admin/news_conadd.php 大概108行处

<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy6243')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy6243>

<input type=”hidden” name=”body” value=”<?php echo $body; ?>” />
<script type=”text/javascript” src=”../../kedit/KindEditor.js”></script>
<script type=”text/javascript”>
var editor = new KindEditor(“editor”);
editor.hiddenName = “body”;
editor.editorWidth = “680px”;
editor.editorHeight = “300px”;
editor.skinPath = “../../kedit/skins/default/”;
editor.uploadPath = “../../kedit/upload_cgi/upload.php”;
editor.imageAttachPath=”news/pics/”;
editor.iconPath = “../../kedit/icons/”;
editor.show();
function KindSubmit() { editor.data(); }
</script>

</td></tr></table>

更换为

<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy4191')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy4191>

<script charset=”utf-8″ src=”../../kindeditor/kindeditor.js”></script>
<script charset=”utf-8″ src=”../../kindeditor/lang/zh_CN.js”></script>
<script>
var editor;
KindEditor.ready(function(K) {
editor = K.create(‘#editor_id’,{
width:’680px’,
height:’300px’,
uploadJson:’upload_json.php’,
fileManagerJson : ‘file_manager_json.php’,
allowFileManager : true,
syncType:”form”, afterCreate : function() { var self = this; self.sync(); }, afterChange : function() { var self = this; self.sync(); }, afterBlur : function() { var self = this; self.sync(); } }); }); </script>
<textarea  name=”body” id=”editor_id” style=”width:680px;height:300px;”/><?php echo $body;?></textarea>

</td></tr></table>

注意:红色标注处,按照官方提供的demo.php文件中写的方法,得不到textarea 里面的内容! 5.复制kindeditorphp文件夹下面upload_json.php和file_manager_json.php (新版中存在 JSON.php也一起复制)文件到newsadmin下 修改2个文件

//文件保存目录路径 $save_path = $php_path . ‘../attached/'; //文件保存目录URL $save_url = $php_url . ‘../attached/';

//文件保存目录路径 $save_path = $php_path . ‘../pics/'; //文件保存目录URL $save_url = $php_url . ‘../pics/';

碰到问题

kindeditor 用ajax提交会出现如下问题: 提交第二次才能获取到真实的值。用如下方法解决:

加一个,afterChange: function (e) { this.sync() }  同步下数据即可

替换就ok:

您可能感兴趣的文章:
phpweb更换kindeditor编辑器的过程
phpweb更换百度编辑器的配置教程
jQuery编辑器KindEditor4.1.4代码高亮显示设置教程
php中kindeditor多图上传session丢失问题解决
jQuery读取和设定KindEditor值的方法
phpweb服务器有哪些
php KindEditor文章内分页的实例方法
KindEditor 实现图文上传方法介绍
KindEditor编辑器调用方法
jQuery自动切换/点击切换选项卡效果代码

[关闭]
~ ~