ecshop 使用 ckeditor 和 ckfinder
ecshop系统是上海商派网络科技有限公司旗下 ,B2C独立网店系统,系统是基于PHP语言及MYSQL数据库构架开发的跨平台开源程序,开放了源程序,适合企业及个人快速构建个性化网上商店,
可是官方的编辑器集成的太烂了,同事张图片可能要传二次,浪费时间和服务器的空间不说,如果产品多这上传太折磨人了,所以有必要把ECShop 编辑器更换成CKEditor,
CKEditor 解压文件至ECShop的includes中,搜索ECShop的admin目录下的所有字符串"fckeditor"替换成"ckeditor","FCKEditor"替换成"CKEditor"
修改adminincludeslib_main.php的function create_html_editor函数:
function create_html_editor($input_name, $input_value = ''){
global $smarty;
//$editor = new CKeditor($input_name);
//$editor->BasePath = '../includes/ckeditor/';
//$editor->ToolbarSet = 'Normal';
//$editor->Width = '100%';
//$editor->Height = '320';
//$editor->Value = $input_value;
//$CKeditor = $editor->CreateHtml(); // 新版没有这个函数
$CKEditor = new CKEditor();
$CKEditor->returnOutput = true; // 这行一定要加不然下面的editor()会在页首直接输出ckeditor对象。
$code = $CKEditor->editor($input_name, $input_value);
$smarty->assign('CKeditor', $code);
}
修改admintemplatesarticle_info.htm的204~207 else代码段
else{
tables[i].style.display = "none";
}
改成
else{
var tblId = tables[i].id.match(/-table$/);
if (tblId == "-table"){
tables[i].style.display = "none";
}
}
改版完成
下面是集成二个软件ckeditor 和ckfinder的方法,这二个软件的官方网分别是 //ckeditor.com 和 //ckfinder.com
分别下载最新的 ckeditor 和ckfinder 放到 ecshop 目录的includes目录下,需要更改的代码如下:以文章为列,其他自行更改
修改文件:/admin/article.php
require_once(ROOT_PATH . "includes/ckeditor/ckeditor.php");
修改文件:/admin/templates/article_info.htm
底部JS处修改,解决显示问题
var tblId = tables[i].id.match(/-table$/);
if (tblId == "-table"){ tables[i].style.display = "none";}
//tables[i].style.display = "none";
修改文件:/admin/includes/lib_main.php
更改create_html_editor函数
function create_html_editor($input_name, $input_value = ''){
global $smarty;
$editor = new CKeditor();
$editor->basePath = '../includes/ckeditor/';
$editor->config['filebrowserBrowseUrl'] = '/includes/ckfinder/ckfinder.html';
$editor->config['filebrowserImageBrowseUrl'] = '/includes/ckfinder/ckfinder.html?type=Images';
$editor->config['filebrowserFlashBrowseUrl'] = '/includes/ckfinder/ckfinder.html?type=Flash';
$editor->config['filebrowserUploadUrl'] = '/includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files';
$editor->config['filebrowserImageUploadUrl'] = '/includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images';
$editor->config['filebrowserFlashUploadUrl'] = '/includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash';
$editor->returnOutput = true;
$code = $editor->editor($input_name, $input_value);
$smarty->assign('FCKeditor', $code);
}
修改文件:/includes/ckfinder/config.php
修改CheckAuthentication函数 ,[这个部分非常重要,关系到网站和服务器的安全问题] 通过一定的权限判断 符合条件的 return true;