来自:hylgs > 馆藏分类
配色: 字号:
彻底更换ecshop编辑器为kindeditor实现在多张图片上传
2013-12-05 | 阅:  转:  |  分享 
  
ecshop彻底编辑器为kindeditor实现在多张图片上传



使用过ECSHOP后台产品、文章编辑的朋友都知道ECSHOP编辑器是''FCKeditor,''FCK官早已经不再更新FCKeditor了,但是ECSHOP却一直还在使用,FCKeditor浏览器的缺点:漏洞多,容易被不怀好意的人利用;不能一次上传多张图片。。。。。





最近发现有网友发过关于用kindeditor替换FCKeditor的文章,感觉FCKeditor还不错。于是就是baidu、google上搜,现把我的使用经验分享给大家。



先来欣赏一下kindeditor编辑器的多图上传功能





下面是实现替换kindeditor编辑器的步骤及方法:









1、从kindedito官网上下载最新版的kindeditor-4.1.10.zip



2、解压kindeditor-4.1.10.zip到kindeditor文件夹,并将kindeditor上传/includes目录下



3、打开/admin/includes/lib_main.php

找到create_html_editor函数,

/

生成编辑器

@paramstringinput_name输入框名称

@paramstringinput_value输入框值

/

functioncreate_html_editor($input_name,$input_value='''')

{

global$smarty;



$editor=newFCKeditor($input_name);

$editor->BasePath=''../includes/fckeditor/'';

$editor->ToolbarSet=''Normal'';

$editor->Width=''100%'';

$editor->Height=''320'';

$editor->Value=$input_value;

$FCKeditor=$editor->CreateHtml();

$smarty->assign(''FCKeditor'',$FCKeditor);

}



把它替换为:

functioncreate_new_kindedit($input_name,$input_value='''')

{

global$smarty;

$kindeditor="



$input_value

";

$smarty->assign(''FCKeditor'',$kindeditor);

}



不管是UTF-8、还是 GBK都适用。注意一定要加上charset=''utf-8''





4、修改includes/kindeditor/php/upload_json.php:



(1)找到:

//文件保存目录路径

在它的下面添加:

$php_save_path=str_replace($php_url,'''',$php_path).''/'';//将上传的文件保存根目录了





(2)找到:

$save_path=$php_path.''../attached/'';

修改为:

$save_url=''images/upload/'';//上传文件保存路径



(3)找到:

$save_url=$php_url.''../attached/'';

修改为:

$save_url=''/images/upload/'';//上传文件保存路径









5、.浏览服务器路径修改includes/kindeditor/php/file_manager_json.php

(1)在$php_url=dirname($_SERVER[''PHP_SELF'']).''/'';的下面添加:

$php_save_path=str_replace($php_url,'''',$php_path).''/'';



(2)找到:

$root_path=$php_path.''../../../upload/'';

修改为:

$root_path=$php_save_path.''images/upload/'';//上传文件保存路径



(3)找到:

$root_url=$php_url.''../attached/'';

修改为:

$save_url=''/images/upload/'';//上传文件保存路径





6、接下来修改ECSHOP后台编辑器调用

(1)打开后台产品/admin/goods.php

找到:

create_html_editor(''goods_desc'',$goods[''goods_desc'']);

修改为

create_new_kindedit(''goods_desc'',$goods[''goods_desc'']);//调用kindeditor编辑器





(2)后台文章:/admin/article.php

找到:

create_html_editor(''FCKeditor1'');

修改为

create_new_kindedit(''FCKeditor1'');//调用kindeditor编辑器



找到:

create_html_editor(''FCKeditor1'',$article[''content'']);

修改为

create_new_kindedit(''FCKeditor1'',$article[''content'']);//调用kindeditor编辑器









kindeditor编辑器限制了最多只能上传20张图怎么办?



打开

/includes/kindeditor/kindeditor-all.js中的

imageUploadLimit=K.undef(self.imageUploadLimit,20),

修改红色数字为你想要的



打开

/includes/kindeditor/plugins/multiimage/multiimage.js



KindEditor.plugin(''multiimage'',function(K){

varself=this,name=''multiimage'',

formatUploadUrl=K.undef(self.formatUploadUrl,true),

uploadJson=K.undef(self.uploadJson,self.basePath+''php/upload_json.php''),

imgPath=self.pluginsPath+''multiimage/images/'',

imageSizeLimit=K.undef(self.imageSizeLimit,''1MB''),

imageFileTypes=K.undef(self.imageFileTypes,''.jpg;.gif;.png''),

imageUploadLimit=K.undef(self.imageUploadLimit,20),

filePostName=K.undef(self.filePostName,''imgFile''),

lang=self.lang(name+''.'');

修改红色数字为你想要的



如果你的kindeditor编辑器已经正常使用了,可以把:

/article.php/goods.php里的

require_once(ROOT_PATH."includes/fckeditor/fckeditor.php");

注释掉或者删除掉,再把/includes/fckeditor目录删除,这样就完全更换了ECSHOP的编辑器了





再见了fckeditor

















http://www.taoyuan99.com/http://www.mqqyp.com/







献花(0)
+1
(本文系hylgs首藏)