最新消息:走过的,离开的,已经错过,新开始2016

ECSHOP集成百度ueditor编辑器并上传图片到又拍云

技术随笔 果果 10713浏览 2评论

研究了几天的ECSHOP图片附件分离,便于做负载均衡。今天接受一下替换掉原来ECSHOP那个不好用的编辑器,使用百度ueditor,并把图片上传到又拍云.

其中得到很多人帮助,一些资料也是其他人提供,在这里收集整理一下,希望对其他人有帮助。

1、打开admin/includes/lib_main.php文件
找到:(大约在306-323行左右)

/**
 * 生成编辑器
 * @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;
 /* 百度编辑器 begin */
 $HTML='
 <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.js"></script>
 <textarea name="'.$input_name.'" id="'.$input_name.'" style="width:100%;">'.$input_value.'</textarea>
 <script type="text/javascript">
 UE.getEditor("'.$input_name.'",{
 theme:"default", //皮肤
 lang:"zh-cn", //语言
 initialFrameWidth:680, //初始化编辑器宽度,默认650
 initialFrameHeight:180 //初始化编辑器高度,默认180
 });
 </script>';
 $smarty->assign('FCKeditor', $HTML);
 /* 百度编辑器 end */
 }

 

2、把admin/js/jquery.js,admin/js/jquery.json.js,admin/js/selectzone_bd.js,admin/js/transport_bd.js复制到你网站相应的目录下

3、复制一份admin/templates/pageheader.htm,将他命名为pageheader_bd.htm文件,然后打开这个文件
找到:
{insert_scripts files=”../js/transport.js,common.js”}
将这段代码修改为:
<!– 百度编辑器 begin –>
{insert_scripts files=”jquery.js,jquery.json.js,transport_bd.js,common.js”}
<!– 百度编辑器 end –>

4、打开admin/templates/article_info.htm文件
找到:
{include file=”pageheader.htm”}
{insert_scripts files=”../js/utils.js,selectzone.js,validator.js”}
将这段代码修改为:
<!– 百度编辑器 begin –>
{include file=”pageheader_bd.htm”}
{insert_scripts files=”../js/utils.js,selectzone_bd.js,validator.js”}
<!– 百度编辑器 end –>

5、打开admin/templates/goods_info.htm文件
找到:
{include file=”pageheader.htm”}
{insert_scripts files=”../js/utils.js,selectzone.js,colorselector.js”}
将这段代码修改为:
<!– 百度编辑器 begin –>
{include file=”pageheader_bd.htm”}
{insert_scripts files=”../js/utils.js,selectzone_bd.js,colorselector.js”}
<!– 百度编辑器 end –>

6、打开admin/templates/topic_edit.htm文件
找到:
{include file=”pageheader.htm”}
{insert_scripts files=”../js/utils.js,selectzone.js,colorselector_topic.js”}
将这段代码修改为:
<!– 百度编辑器 begin –>
{include file=”pageheader_bd.htm”}
{insert_scripts files=”../js/utils.js,selectzone_bd.js,colorselector_topic.js”}
<!– 百度编辑器 end –>

7、打开admin/article.php文件
(1)找到:(大约在20行左右)
require_once(ROOT_PATH . “includes/fckeditor/fckeditor.php”);
将这段代码修改为:
/* 百度编辑器 begin */
//require_once(ROOT_PATH . “includes/fckeditor/fckeditor.php”);
/* 百度编辑器 end */

(2)找到:(大约在207行左右)
create_html_editor(‘FCKeditor1’,$article[‘content’]);
将这段代码修改为:
create_html_editor(‘FCKeditor1’,htmlspecialchars($article[‘content’])); /* 百度编辑器 */

8、打开admin/goods.php文件
(1)找到:(大约在107行左右)
include_once(ROOT_PATH . ‘includes/fckeditor/fckeditor.php’); // 包含 html editor 类文件
将这段代码修改为:
/* 百度编辑器 begin */
//include_once(ROOT_PATH . ‘includes/fckeditor/fckeditor.php’); // 包含 html editor 类文件
/* 百度编辑器 end */

(2)找到:(大约在414行左右)
create_html_editor(‘goods_desc’, $goods[‘goods_desc’]);
将这段代码修改为:
create_html_editor(‘goods_desc’, htmlspecialchars($goods[‘goods_desc’])); /* 百度编辑器 */

9、打开admin/magazine_list.php文件
(1)找到:(大约在61行左右,第一次出现的地方)
include_once(ROOT_PATH.’includes/fckeditor/fckeditor.php’); // 包含 html editor 类文件
将这段代码修改为:
/* 百度编辑器 begin */
//include_once(ROOT_PATH.’includes/fckeditor/fckeditor.php’); // 包含 html editor 类文件
/* 百度编辑器 end */

(2)找到:(大约在83行左右,第二次出现的地方)
include_once(ROOT_PATH.’includes/fckeditor/fckeditor.php’); // 包含 html editor 类文件
将这段代码修改为:
/* 百度编辑器 begin */
//include_once(ROOT_PATH.’includes/fckeditor/fckeditor.php’); // 包含 html editor 类文件
/* 百度编辑器 end */

(3)找到:(大约在91行左右)
create_html_editor(‘magazine_content’, $rt[‘template_content’]);
将这段代码修改为:
create_html_editor(‘magazine_content’, htmlspecialchars($rt[‘template_content’])); /* 百度编辑器 */

10、打开admin/topic.php文件
(1)找到:(大约在75行左右)
include_once(ROOT_PATH.’includes/fckeditor/fckeditor.php’); // 包含 html editor 类文件
将这段代码修改为:
/* 百度编辑器 begin */
//include_once(ROOT_PATH.’includes/fckeditor/fckeditor.php’); // 包含 html editor 类文件
/* 百度编辑器 end */

(2)找到:(大约在102行左右)
create_html_editor(‘topic_intro’, $topic[‘intro’]);
将这段代码修改为:
create_html_editor(‘topic_intro’, htmlspecialchars($topic[‘intro’])); /* 百度编辑器 */

11、下载UPYUN ueditor 修改的包。

https://github.com/lvtongda/ueditor-for-UPYUN/archive/master.zip

下载解压重命名为ueditor,上传到includes/目录。

修改 upyun.config.sample.php 为 upyun.config.php,修改 ueditor.config.sample.js 为 ueditor.config.js

12、配置 upyun.config.php 中的又拍云存储授权信息

// 图片类空间
$img_bucket = “”; // 空间名
$img_username = “”; // 操作员帐号
$img_passwd = “”; // 操作员密码
// 文件类空间
$file_bucket = “”; // 空间名
$file_username = “”; // 操作员帐号
$file_passwd = “”; // 操作员密码
配置 ueditor.config.js 中的空间名

var img_bucket = “”; // 图片空间名
var file_bucket = “”; // 文件空间名

13,访问https://127.0.0.1/includes/ueditor/  测试功能是否正常,正常后删除includes/index.php

转载请注明:果果.IT » ECSHOP集成百度ueditor编辑器并上传图片到又拍云

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (2)

  1. 博主,我在segmentfault上看到了你把商品图片和相册已经完成又拍云整合,这个能不能分享下如何整合呢?我非常需要把这两个的图片分离到又拍云
    求知8年前 (2016-02-25)
  2. 编辑器的图片上传可以按照我文件说明操作,商品图片由于也是受其他人帮助完成的,你可以咨询企鹅 九四贰零八捌五Ⅳ零
    果果8年前 (2016-02-29)