在線(xiàn)客服

    電話(huà)①:189 6508 9135(張先生)
    電話(huà)②:134 0599 8886(何小姐)
    電話(huà)③:0591-83489135

    技術(shù)文章


    ecshop編輯器FCKeditor修改成KindEditor編輯器



    今天福州印秀網(wǎng)絡(luò)就分享一下怎么換掉fck編輯器,放上實(shí)用的kindeditor編輯器,網(wǎng)絡(luò)上其他版本都有問(wèn)題,我重新整理整理后正確版。方法如下:

    1、官方網(wǎng)站下載最新版kindeditor

    現(xiàn)在最先版本的是:kindeditor4.1.11,官方網(wǎng)址:http://www.kindsoft.net

    2、上傳解壓

    上傳下載的壓縮文件到你的網(wǎng)站include目錄下,解壓kindeditor4.1.11,將其文件夾名稱(chēng)改為:kind123~editor789(注意:加上數(shù)字和符號(hào)防止猜測(cè)地址)

    3、修改php文件

    (1)打開(kāi)admin/includes/lib_main.php,查找 create_html_editor
    將以下內(nèi)容:
    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/';

    瀏覽服務(wù)器路徑修改includes/kindeditor/php/file_manager_json.php如下:

    //根目錄路徑,可以指定絕對(duì)路徑,比如 /var/www/attached/
    $root_path = $php_path . '../../../images/upload/';

    //根目錄URL,可以指定絕對(duì)路徑,比如 http://www.yoursite.com/attached/
    $root_url = $php_url . '../../../images/upload/';

    4、經(jīng)過(guò)前兩個(gè)步驟基本上已經(jīng)更換完成,但是在商品編輯頁(yè)有個(gè)js會(huì)造成不能保存kingeditor編輯的信息,打開(kāi)admin/template/goods_info.htm這個(gè)文件

    找到<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)這個(gè)方法,找到下面的document.forms[‘theForm’].submit();注釋掉這句代碼,

    改為:document.getElementById(‘sub’).click();

    然后就可以使用新的編輯器了。

    5、kindeditor默認(rèn)上傳圖片的路徑是upload下面的image目錄下面,以年月日為目錄,如:image/20130401 我們把它修改為:以年月劃分比較好。
    在upload_json.php找到$ymd = date("Ymd"); 改為:$ymd = date("Ym");就可以了。

    ok,大功告成,在ecshop最新版本親測(cè)正常使用。


    相關(guān)文章

    首頁(yè)  電話(huà)  咨詢(xún)  頂部
    久久精品韩国AV电影,人妻无码在线一区二区,97国产在线,涩涩亚洲中文无码