將 Ecshop 後台編輯器改為 kindeditor 編輯器 20180401修正
2018-03-15
642
相關文章
由於網路技術的不斷更新,ECSHOP 除了PHP版本的升級外,還有部分如後台使用框架集與文字編輯器等,都需要做更新,以確保網站後台的操作無誤,其中預設的 fckeditor 編輯器因為官方早已不再維護,因此可能導致無法顯示的問題,也就是編輯器的位置一片空白,因此將其換成 kindeditor 編輯器便可解決問題,方法如下:
(1) 到官方網站下載編輯器檔案 https://kindeditor.net/down.php ,目前的版本是4.1.1,下載後解壓縮至此將得到kindeditor資料夾
(2) 將kindeditor資料夾裡的asp、asp.net、jsp 三個資料夾和 php/demo.php 刪除
(3) 用文字編輯器打開kindeditor/php/file_manager_json.php 將
//根目錄路徑,可以指定絕對路徑,比如 /var/www/attached/ $root_path = $php_path . '../attached/'; //根目錄URL,可以指定絕對路徑,比如 https://www.yoursite.com/attached/ $root_url = $php_url . '../attached/';
改為
//根目錄路徑,可以指定絕對路徑,比如 /var/www/attached/ $root_path = $php_path . '../../../images/upload/'; //根目錄URL,可以指定絕對路徑,比如 https://www.yoursite.com/attached/ $root_url = $php_url . '../../../images/upload/';
(4) 用文字編輯器打開kindeditor/php/upload_json.ph 將
//文件保存目錄路徑 $save_path = $php_path . '../attached/'; //文件保存目錄URL $save_url = $php_url . '../attached/';
改為
//文件保存目錄路徑 $save_path = $php_path . '../../../images/upload/'; //文件保存目錄URL $save_url = $php_url . '../../../images/upload/'; $ymd = date("Ymd"); 改為 $ymd = date("Ym");
(5) 將kindeditor整個資料夾上傳到EC根目錄的includes內
(6) 修改EC根目錄的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="$input_value"; $smarty->assign('FCKeditor', $kindeditor); }
(7) 最後如果你是使用2.7.3版本的ecshop請修改admin/template/goods_info.htm將 line429
<input type="button" value="{$lang.button_submit}" onclick="validate('{$goods.goods_id}')" />
改為
<input type="submit" value="{$lang.button_submit}" onclick="validate('{$goods.goods_id}')" />
如果你對將 Ecshop 後台編輯器改為 kindeditor 編輯器 20180401修正有任何問題請到討論區發帖。