正在为您加载需要的页面,请稍后...
格子云网络,我们专为建站而生
. . .

技术共享

当前位置:格子云 > 动态 > 技术共享 >

已阅读

将ECSHOP的FCK编辑器改为Kindeditor编辑器

来源:sywer       时间:2016-05-25 21:01         责任编辑:sywer
kindeditor此编辑器可以让ecshop批量上传图片,可以插入代码,可以全屏编辑,可以插入地图、视频,进行更多word操作,设置字体。
步骤一
进入kindeditor的官网,http://kindeditor.net/down.php下载最新的编辑器版本,解压后,将文件夹改名kindeditor,上传到网站includes/目录下,注意,要可以访问到includes/kindeditor/kindeditor-min.js
也可以下载懒人包,懒人包已经改好了,只需进行到步骤二步骤五
点击下载懒人包

步骤二
使用用文本工具(推荐Notepad++
打开admin/includes/lib_main.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="<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 : '100%',
                    height: '300px',
                    resizeType: 0   //0固定宽高 1 宽度自由调节  2 宽,高可自由调节
                });
            });
    </script>
    <textarea id=\"$input_name\" name=\"$input_name\" style='width:100%;height:300px;'>$input_value</textarea>
 <input type=\"submit\" value=\"提交\" />
    ";
    $smarty->assign('FCKeditor', $kindeditor);
}

步骤三
打开includes/kindeditor/php/upload_json.php
将:
//文件保存目录路径
$save_path = $php_path . '../attached/';
//文件保存目录URL
$save_url = $php_url . '../attached/';

修改为: 
//文件保存目录路径
$save_path = $php_path . '../../../images/upload/';
//文件保存目录URL
$save_url = $php_url . '../../../images/upload/';


步骤四

打开includes/kindeditor/php/file_manager_json.php
将:
 
//根目录路径,可以指定绝对路径,比如 /var/www/attached/
$root_path = $php_path . '../attached/';
//根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
$root_url = $php_path . '../attached/';
 
修改为:
 
//根目录路径,可以指定绝对路径,比如 /var/www/attached/
$root_path = $php_path . '../../../images/upload/';
//根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
$root_url = $php_url . '../../../images/upload/';


步骤五

打开admin/template/goods_info.htm
将:
 <input type="button" value="{$lang.button_submit}" class="button" onclick="validate('{$goods.goods_id}')" />
 
修改为
 
<input type="submit" value="{$lang.button_submit}" class="button" onclick="validate('{$goods.goods_id}')" />

进后台刷新就可以了,如果上传图片发现没有文件权限,记得进服务器刷一遍777权限。