phpcms2008fckeditor编辑器更换为百度ueditor编辑器
2013-12-10 12:12:04

需要提供编辑器更换服务,请联系QQ179270844

在浏览器升级到IE9以后,phpcms2008的编辑器就开始出现问题了:不能弹出图片上传界面,内容编辑器方框一片空白。总之,在IE9以后版本的浏览器中,FCKeditor编辑器就不再能正常使用。这样的情况下,自然就想到了更换编辑器,而首选的目标编辑器就是百度Ueditor编辑器。

实际更换编辑器的过程并不复杂,按照下述的步骤进行升级,一般都会成功。

1.下载最新版的百度编辑器下载地址http://ueditor.baidu.com/ 。分两种版本:UTF-8和GBK,按需下载!

 2.将编辑器更名ueditor 放在网站根目录

3.找到include/form.class.php

 function editor($textareaid = 'content', $toolbar = 'Basic', $width = '600', $height = "400", $isshowext = 1)
 {
。。。。。。。。。。。
}

修改为

function editor($textareaid = 'content', $toolbar = 'Basic', $width = '600', $height = "400", $isshowext = 1)
 {
   //global $PHPCMS, $mod, $file, $catid, $_userid;

   
//global $PHPCMS, $mod, $file, $catid, $_userid;
  
   $str = "<script type=\"text/javascript\" src=\"/ueditor/ueditor.config.js\"></script><script type=\"text/javascript\" charset=\"utf-8\" src=\"/ueditor/ueditor.all.js\"></script><script language=\"JavaScript\" type=\"text/JavaScript\">UE.getEditor('".$textareaid."');";
   $str .= "</script>";
   return $str;

 }

 4.打开include\fields\editor\form.inc.php 去掉display=none

经过以上四个步骤,再去后台发布信息,看一下新的Ueditor编辑器是否生效了。原来的FCKeditor编辑器已经不见了,正常情况下,新的编辑器已经可以使用了。

这里还有一点需要补充的,在使用百度ueditor编辑器上传图片附件时,需要将文件上传到网站的指定目录中。例如ueditor规定图片的存储目录为upload1,upload2,upload3,三选一。你只要在网站的根目录下建立这三个目录并赋予写权限就可以了。