今天福州印秀网络就分享一下怎么换掉fck编辑器,放上实用的kindeditor编辑器,网络上其他版本都有问题,我重新整理整理后正确版。方法如下:
1、官方网站下载最新版kindeditor
现在最先版本的是:kindeditor4.1.11,官方网址:http://www.kindsoft.net
2、上传解压
上传下载的压缩文件到你的网站include目录下,解压kindeditor4.1.11,将其文件夹名称改为:kind123~editor789(注意:加上数字和符号防止猜测地址)
3、修改php文件
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);
}
function create_html_editor($input_name, $input_value = '')
{
global $smarty;
$kindeditor="
<link rel='stylesheet' href='../includes/kind123~editor789/themes/default/default.css' />
<link rel='stylesheet' href='../includes/kind123~editor789/plugins/code/prettify.css' />
<script charset='utf-8' src='../includes/kind123~editor789/kindeditor-all-min.js'></script>
<script charset='utf-8' src='../includes/kind123~editor789/lang/zh_CN.js'></script>
<script charset='utf-8' src='../includes/kind123~editor789/plugins/code/prettify.js'></script>
<script>
var editor;
KindEditor.ready(function(K) {
editor = K.create('textarea[name=\"$input_name\"]', {
allowFileManager : true,
width : '100%',
height: '600px',
resizeType: 0 //固定宽高
});
});
</script>
";
$smarty->assign('FCKeditor', $kindeditor);
}
(2)修改kindeditor/php/
上传目录修改includes/kindeditor/php/upload_json.php如下:
//文件保存目录路径
$save_path = $php_path . '../../../images/upload/';
//文件保存目录URL
$save_url = '/images/';
浏览服务器路径修改includes/kindeditor/php/file_manager_json.php如下:
//根目录路径,可以指定绝对路径,比如 /var/www/attached/
$root_path = $php_path . '../../../images/upload/';
//根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
$root_url = $php_url . '../../../images/upload/';
4、经过前两个步骤基本上已经更换完成,但是在商品编辑页有个js会造成不能保存kingeditor编辑的信息,打开admin/template/goods_info.htm这个文件
找到<input type=”button” value=”{$lang.button_submit}” class=”button” onclick=”validate(‘{$goods.goods_id}’)”/>
这句代码在下面加上
<input type=”submit” id =‘sub’ style=”display:none;” />
然后找到function validate(goods_id)这个方法,找到下面的document.forms[‘theForm’].submit();注释掉这句代码,
改为:document.getElementById(‘sub’).click();
然后就可以使用新的编辑器了。
5、kindeditor默认上传图片的路径是upload下面的image目录下面,以年月日为目录,如:image/20130401 我们把它修改为:以年月划分比较好。
在upload_json.php找到$ymd = date("Ymd"); 改为:$ymd = date("Ym");就可以了。
ok,大功告成,在ecshop最新版本亲测正常使用。