欢迎各位兄弟 发布技术文章
这里的技术是共享的
echsop ueditor插件(ueditor和解决冲突的js) 在 本站 附件 这个附件同样在自己网盘上
(附件里面的 transport_json.js 可能有点小问题,可能需要修改)
ECSHOP系统自带的编辑器大家用过都知道,难用不说,还不能批量上传图片。很多朋友都喜欢百度编辑器,因为百度编辑器功能强大,使用方便,而且不会生成太多多余代码。
网上有许多ECSHOP整合百度编辑器的教程,但大多都有一些问题。
ECSHOP模板屋提供一个比较完整的教程。
先看效果图:
教程开始:
先到百度编辑器官网下载最新版,将文件夹改名为“ueditor”,上传到 /includes/ 目录下
(也可以在本教程底部下载制作好的ueditor1.4.3版)
打开文件,商品编辑文件
/admin/templates/goods_info.htm
查找:
| 1 | {$FCKeditor} | 
修改成:
<script type="text/javascript" charset="utf-8" src="../includes/ueditor/ueditor.config.js"></script><script type="text/javascript" charset="utf-8" src="../includes/ueditor/ueditor.all.min.js"> </script><!--建议手动加在语言,避免在ie下有时因为加载语言失败导致编辑器加载失败--><!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型,比如你在配置项目里配置的是英文,这里加载的中文,那最后就是中文--><script type="text/javascript" charset="utf-8" src="../includes/ueditor/lang/zh-cn/zh-cn.js"></script><style type="text/css">.clear {clear: both;}</style><textarea id="goods_desc" name="goods_desc" style="width:100%;height:500px;"> {$goods.goods_desc}</textarea><script type="text/javascript">delete(Object.prototype.toJSONString);UE.getEditor('goods_desc')</script>打开文件,文章编辑文件
/admin/templates/article_info.htm
查找:
| 1 | {$FCKeditor} | 
修改成:
<script type="text/javascript" charset="utf-8" src="../includes/ueditor/ueditor.config.js"></script><script type="text/javascript" charset="utf-8" src="../includes/ueditor/ueditor.all.min.js"> </script><!--建议手动加在语言,避免在ie下有时因为加载语言失败导致编辑器加载失败--><!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型,比如你在配置项目里配置的是英文,这里加载的中文,那最后就是中文--><script type="text/javascript" charset="utf-8" src="../includes/ueditor/lang/zh-cn/zh-cn.js"></script><style type="text/css">.clear {clear: both;}</style><textarea id="goods_desc" name="Fckeditor1" style="width:100%;height:500px;"> {$article.content}</textarea><script type="text/javascript">delete(Object.prototype.toJSONString);UE.getEditor('goods_desc')</script>注意这行代码:
<textarea id="goods_desc" name="goods_desc" style="width:100%;height:500px;"> {$goods.goods_desc}</textarea>
<textarea id="goods_desc" name="Fckeditor1" style="width:100%;height:500px;"> {$article.content}</textarea>
width和height分别是指编辑器的大小,但是IE内核的浏览器,有可能不支持写成px,所以编辑器的大小可能有些不完美,这是跟CSS有关,这个可以自行解决。
这个时候,其实ECSHOP后台编辑器其实已经可以正常使用了,只是进入商品列表、分类等等,会报错的,提示缺少Ajax:
下面接着提供解决方法
打开 /admin/templates/pageheader.htm
在头部找到:
| 1 | {insert_scripts files="../js/transport.js,common.js,../js/utils.js"} | 
修改为:
<script type="text/javascript" src="../includes/ueditor/fix_jquery/jquery.min.js" rel="stylesheet" /></script><script type="text/javascript" src="../includes/ueditor/fix_jquery/jquery.json-1.3.js" rel="stylesheet" /></script><script type="text/javascript" src="js/common.js" rel="stylesheet" /></script><script type="text/javascript" src="../includes/ueditor/fix_jquery/transport_json.js" rel="stylesheet" /></script>{insert_scripts files="../js/utils.js"}这样就可以了。
注意,不要忘记了引用的JQ文件。。
下面的ecshop更换百度ueditor插件.zip已经包含
| 附件 | 大小 | 
|---|---|
|  ecshop更换百度ueditor插件.zip | 2.93 MB |