ECSHOP后台编辑器替换为UEditor教程
1、获取Ueditor 1.4.3版本(截至2026-03-03的最新版本)
官方下载地址:http://ueditor.baidu.com/website/download.html 同时需要下载解决jQuery冲突的相关文件。 提供的资源文件中已包含针对JS冲突的修改文件,并且php/config.json中的图片保存路径已预先修改好,用户也可根据需要自行调整! 由于作者使用的是mac OS系统,压缩包内可能包含.DS_store文件,这些可以忽略或直接删除。 备用下载地址:http://pan.baidu.com/s/1gdglb0J 密码:fflu (由老杨提供)
2、将文件上传至网站服务器
解压后,将名为uediter的目录上传至网站根目录下的/includes文件夹中。 解压老杨提供的资源包,将fix_jquery文件上传至ueditor目录内部。
3、修改/admin/includes/lib_main.php文件
定位到以下函数位置:
复制代码 代码如下: /** * 生成编辑器 * @param string input_name 输入框名称 * @param string input_value 输入框值 */ function create_html_editor($input_name, $input_value = '') { global $smarty; $editor = new FCKeditor($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); }
将其替换为如下代码:
复制代码 代码如下: /** * 生成编辑器 * @param string input_name 输入框名称 * @param string input_value 输入框值 */ function create_html_editor($input_name, $input_value = '') { global $smarty; $kindeditor=" "; $smarty->assign('FCKeditor', $kindeditor); }
4、修改/admin/templates/pageheader.htm文件
查找以下代码行:
复制代码 代码如下: {insert_scripts files="../js/transport.js,common.js,../js/utils.js"}
将其替换为:
复制代码 代码如下: {insert_scripts files="../js/utils.js"}
5、修复商品编辑时编辑器被重置导致UEditor无法保存内容的Bug。
涉及文件:/admin/templates/goods_info.htm 找到以下代码:
复制代码 代码如下: document.forms['theForm'].reset();
对该行代码进行注释处理:
复制代码 代码如下: //document.forms['theForm'].reset();
以上内容即为本次修改的全部步骤,希望能帮助到大家。