使用kindeditor来替换ecshop的fckeditor编辑器,让ecshop可以批量上传图片

老杨原创

kindeditor此编辑器可以让ecshop批量上传图片,可以插入代码,可以全屏编辑,可以插入地图、视频,进行更多word操作,设置字体。

步骤一:进入kindeditor的官网,http://kindeditor.net/index.php下载最新的编辑器版本,将文件上传到网站includes/目录下,注意,不要有多余的目录,要可以访问到includes/kindeditor/kindeditor-min.js

步骤二:

1、修改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\"]', {//www.lyecs.com 
                    allowFileManager : true,
                    width : '100%',
                    height: '300px',
                    resizeType: 0   //固定宽高
                });
            });
    </script>
    <textarea id=\"$input_name\" name=\"$input_name\" style='width:100%;height:300px;'>$input_value</textarea>
 <input type=\"submit\" value=\"提交\" />
    ";
    $smarty->assign('FCKeditor', $kindeditor);
}

 

2、找到

includes/kindeditor/php/upload_json.php


//文件保存目录路径
$save_path = $php_path . '../attached/';
//文件保存目录URL
$save_url = $php_url . '../attached/';
 

替换为
//文件保存目录路径www.lyecs.com老杨ecshop二次开发
$save_path = $php_path . '../../../images/upload/';
//文件保存目录URL
$save_url = $php_url . '../../../images/upload/';

3、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/';

3、找到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权限。

posted @ 2015-06-24 16:42  brady-wang  阅读(459)  评论(0编辑  收藏  举报