FCKEDITOR配置:
一、精簡:
1,_都可除掉。
2,fckeditor/editor/lang 可剩 en,zh,zh-cn
3,fckeditor/editor/filemanager/connectors 可只剩 本語言 如php
二、設置
1.更改默認語言和編程語言:
打開/fckeditor/fckconfig.js ;(千萬注意這個文件是utf-8編碼,我第一次編輯的時候保存成了ANSI格式結果出錯了,找了好長時間原因)修改->
FCKConfig.AutoDetectLanguage =false;(使其不能根據系統語言自動檢測加載相應的語言。)
var FCKConfig.DefaultLanguage = ‘zh-cn’ ;
var _FileBrowserLanguage = ‘php’ ;
var _QuickUploadLanguage = ‘php’ ;
2.開啓文件上傳的功能:
配置editor/filemanager/connectors/php/config.php
$Config['Enabled'] = true ;
更改$Config['UserFilesPath'] = ‘/userfiles/’ ;爲你的上傳目錄(注意:這個目錄要存在——自己創建好);
三、調用
可以按下面的例子在php(例子中的PHP文件放在網站的子目錄中)中調用fckeditor編輯器:
include(”../fckeditor/fckeditor.php”); // 包含fckeditor類,fckeditor目錄放在網站根目錄下
$BasePath = “/fckeditor/”; // 編輯器路徑
$oFCKeditor = new FCKeditor(’CreMer’); // 創建一個fckeditor對象,表單的名稱爲CreMer
$oFCKeditor->BasePath = $BasePath;
$oFCKeditor->Value = ‘test’; // 設置表單初始值
// 還可設置以下部分(“=”包含部分),並非必須:
//==================================================================================//
$oFCKeditor->Width = ‘800′; // 編輯器寬度,類中有默認值,如果不想修改可不管此項
$oFCKeditor->Height= ‘300′; // 同width,此處爲高$oFCKeditor->ToolbarSet
$oFCKeditor->ToolbarSet = ‘Basic’; // 默認編輯器工具欄有Basic(基本工具)和Default(所有工具)兩種選擇,另外還可以自己建立工具欄
$oFCKeditor->Config['SkinPath'] = ‘/fckeditor/editor/skins/silver/’; // 設置編輯器皮膚
//==================================================================================//
$oFCKeditor->Create(); // 調用類中方法,必須
用$_POST['CreMer']就能獲取文本框裏面的值。
說明:
//包含fckeditor類
include(”../fckeditor/fckeditor.php”) ;
//設置編輯器路徑
$sBasePath = “fckeditor/”;
//創建一個Fckeditor,表單的txtarea名稱爲content
$oFCKeditor = new FCKeditor(’content’) ;
$oFCKeditor->BasePath = $sBasePath ;
//設置表單初始值
$oFCKeditor->Value = ‘This is some <strong>sample text</strong>’ ;
$oFCKeditor->Create() ;
//設置長寬
$oFCKeditor->Width
$oFCKeditor->Height
$oFCKeditor->ToolbarSet
四、我的算定義工具欄:
FCKConfig.ToolbarSets["Zhuo"] = [
['Source','Preview'],
['OrderedList','UnorderedList','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Image','Flash','SpecialChar'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
'/',
['FontFormat','FontName','FontSize'],
['Bold','Italic','Underline'],
['TextColor','BGColor'],
['FitWindow','ShowBlocks'] // No comma for the last row.
] ;