首页 > 教程 >

将phpcms默认ckeditor编辑器换成KindEditor

2023-02-20教程围观

简介最近研究phpcms,发现默认编辑器实在不好用,本人不太喜欢ckeditor,相对喜欢国产轻量级KindEditor一点,查找资料湖决定将其换掉,本地UTF-8测试成功,GBK未测,有兴趣的可以尝试一下,方法都是一样的!现上张图看效果吧!具体做法如下:首先,去kindeditor官网下载一个新的编辑器,解压后将其整个文件夹重命名为kindeditor,并复制到staticsjs目录;然后修改php

  

最近研究 phpcms,发现 默认 编辑器实在不好用,本人不太喜欢 ckeditor,相对喜欢国产轻量级KindEditor一点,查找资料湖决定将其换掉,本地UTF-8测试成功,GBK未测,有兴趣的可以尝试一下,方法都是一样的!

现上张图看效果吧! 

将phpcms默认ckeditor编辑器换成KindEditor


具体做法如下:

首先,去 kindeditor官网下载一个新的编辑器,解压后将其整个文件夹重命名为kindeditor,并复制到staticsjs目录;

然后修改phpcmslibsclassesform.class.php

查找

if(!defined('EDITOR_INIT')) {

如果你没修改过这个文件的话在第18行,

$str = '<  type="text/ " src="'.JS_PATH."ckeditor/ckeditor.js"></ >';define('EDITOR_INIT', 1);

 

替换为

$str .= '<  charset="utf-8" type="text/ " src="'.JS_PATH."kindeditor/kindeditor-min.js"></ >';$str .= '<  charset="utf-8" type="text/ " src="'.JS_PATH."kindeditor/lang/zh_CN.js"></ >';		define('EDITOR_INIT', 1);			$str .= "<  type="text/ ">rn";$str .= "KindEditor.ready(function(K) {rn";$str .= "editor = K.create('textarea[id="$textareaid"]', {rn";$str .= "allowFileManager : true,rn";	$str .= "width : '99%',";$str .= "height : '400px'";$str .= "});";$str .= "});";$str .= '</ >';


保存,刷新,可以看到,编辑器已经换为KindEditor的了,但是测试发现,无法上传图片,附件等等!

下面需要做一些修改:

打开staticsjskindeditorphpfile_manager_json.php

将:

//根目录路径,可以指定绝对路径,比如 /var/www/attached/$root_path = $php_path . '../attached/';//根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/$root_url = $php_url . '../attached/';

修改为phpcms的上传目录既可

//根目录路径,可以指定绝对路径,比如 /var/www/attached/$root_path = $php_path . '../../../../uploadfile/';//根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/$root_url = $php_url . '../../../../uploadfile/';

同样将staticsjskindeditorphpupload_json.php中的

//文件保存目录路径$save_path = $php_path . '../attached/';//文件保存目录URL$save_url = $php_url . '../attached/';//定义允许上传的文件扩展名

修改为:

//文件保存目录路径$save_path = $php_path . '../../../../uploadfile/';//文件保存目录URL$save_url = $php_url . '../../../../uploadfile/';//定义允许上传的文件扩展名

将文章发布页面调整为全屏,个人喜好,无关紧要!可不修改!

将staticscsszh-cn-system.css中的:

.addContent{width:960px; margin:0 auto; overflow:hidden;}

修改为:

.addContent{width:99%; margin:0 auto; overflow:hidden;}

好了,到此为止,基本上就与使用了,如果用什么觉得不美观的,可以自己试着进行修改!

KindEditor编辑器自我觉得使用很方便,所以推荐,本站已经发表过

为kindsoft编辑器替换SyntaxHighlighter代码高亮

等一些教程,有需要的可以看一看

 

对了,如果嫌弃本教程麻烦,可以下载本站为您提供的一键傻瓜式安装包,已经修改好的,上传覆盖即可,为了安全期间,建议做好文件备份!!!

傻瓜式覆盖包传送门

本教程可能会有更新,请留意,如有疑问,欢迎留言咨询!

 

2013-01-09修正:

 

2013-01-09 修复网友提出的一系列问题,主要为“分页”和“子标题”,当然,使用的时候记得需要选择手动分页哈!加入了代码运行!记得前台引用所需文件具体为:

<  href="/statics/js/kindeditor/plugins/runCode/runCode.css" rel="stylesheet" type="text/css" /><  language=" " type="text/ " src="/statics/js/kindeditor/plugins/runCode/zztuku_runCode.js"></ > 

 

下载链接:网站源码/小程序源码/网站模板下载

Tags: 编辑器 换成 默认 ckeditor