本人在二次開發ecshop 2.7.1引入了JQuery后FckEditor一直有問題,點擊FckEditor上的功能按鈕后只出現個"Cancel"按鈕,其他都被"div"層履蓋,只能刷新重來。最近有機會來做SEO優化,經常要發軟文,有必要把FckEditor修復一下。
在網上搜了一下,發現FckEditor已經升級了,本文編輯時的版本是CKEditor 3.5.2。
下載CKEditor - CKEditor 3.5.2
解壓文件至ECShop的includes中。
搜索ECShop的admin目錄下的所有字符串"fckeditor"替換成"ckeditor","FCKEditor"替換成"CKEditor"。(注:大小寫分開替換)
修改admin/includes/lib_main.php的function create_html_editor函數:
function create_html_editor($input_name, $input_value = '')
{
global $smarty;
//$editor = new CKeditor($input_name);
//$editor->BasePath = '../includes/ckeditor/';
//$editor->ToolbarSet = 'Normal';
//$editor->Width = '100%';
//$editor->Height = '320';
//$editor->Value = $input_value;
//$CKeditor = $editor->CreateHtml(); // 新版沒有這個函數
$CKEditor = new CKEditor();
$CKEditor->returnOutput = true; // 這行一定要加不然下面的editor()會在頁首直接輸出ckeditor對象。
$code = $CKEditor->editor($input_name, $input_value);
$smarty->assign('CKeditor', $code);
}
還要修改admin/templates/article_info.htm的204~207 else代碼段
else
{
tables[i].style.display = "none";
}
改成
else
{
var tblId = tables[i].id.match(/-table$/);
if (tblId == "-table")
{
tables[i].style.display = "none";
}
}
到此改版基本完成,對ckeditor也是剛剛接觸,如果上面的方法有什么問題,可以留言告知!??!
新聞熱點
疑難解答