刚刚玩Ecshop,发现自带的fck编辑器已经不太好用了。下面我就分几步替换编辑器,附件上传路径放在网站根目录/upload/下,根据各自实际情况修改。
1.官网http://www.kindsoft.net/down.php下载最新版kindeditor-4.1.4.zip
2.解压kindeditor 将其复制到 includes目录下 文件夹名称命名为 kindeditor
3.打开admin/includes/lib_main.php,找到 create_html_editor 函数,复制一份 改个名字 create_html_kindeditor (当然也可以是其它名 字)
4. create_html_kindeditor 函数的内容为:
function create_html_kindeditor($input_name, $input_value = '')
{
global $smarty;
$kindeditor="<script charset='utf-8' src='../includes/kindeditor/kindeditor-min.js'></script>
<script>
var editor;
KindEditor.ready(function(K) {
editor = K.create('textarea[name=\"$input_name\"]', {
allowFileManager : true,
width : '700px',
height: '300px',
resizeType: 0 //固定宽高
});
});
</script>
<textarea id=\"$input_name\" name=\"$input_name\" style='width:600px;height:500px;'>$input_value</textarea>
";
$smarty->assign('FCKeditor', $kindeditor); //这里前面的 FCKEditor 不要变
}
5.. 上传目录修改includes/kindeditor/php/upload_json.php如下:
$php_save_path=str_replace($php_url,'',$php_path). '/'; // 这里很重要 不然就保存不到根目录了 网上那些都乱七八糟的路径
//文件保存目录路径
//$save_path = $php_path . '../attached/';
$save_path = $php_save_path . 'upload/';
//文件保存目录URL
//$save_url = $php_url . '../attached/';
$save_url = '/upload/'; //这个是上传后保存数据库的路径
6.浏览服务器路径修改includes/kindeditor/php/file_manager_json.php如下:
$php_save_path=str_replace($php_url,'',$php_path). '/'; // 这里很重要 不然就保存不到根目录了 网上那些都乱七八糟的路径
//根目录路径,可以指定绝对路径,比如 /var/www/attached/
//$root_path = $php_path . '../attached/';
$root_path = $php_save_path . 'upload/';
//根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
//$root_url = $php_url . '../attached/';
$root_url = '/upload/';//这个是上传后保存数据库的路径
最后要让它显示出来站长教学网 eduyo.com
商品替换编辑器:找到admin/goods.php
/* 创建 html editor */
//create_html_editor('goods_desc', $goods['goods_desc']);
create_html_kindeditor('goods_desc', $goods['goods_desc']);// 替换成上面自己定义的函数
文章替换编辑器:找到admin/article.php
/* 创建 html editor 添加新闻时候的编辑器 */
//create_html_editor('FCKeditor1');
create_html_kindeditor('FCKeditor1');// 替换成上面自己定义的函数
/* 创建 html editor 编辑新闻时候的编辑器*/
// create_html_editor('FCKeditor1',$article['content']);
create_html_kindeditor('FCKeditor1',$article['content']);// 替换成上面自己定义的函数
到这里大功告成,都是使用了最新版,顺利通过。有问题可以给我留言admin@eduyo.com
ken
(责任编辑:ken)