1、首先去官網下載FCKeditor2.6.5 多國語言版。http://ckeditor.com/download,注意:第一個為最新3.0.1版,第二個才是FCKeditor 2.6.5
2、刪除不必要的東西:
刪除/FCKeditor/目錄下除fckconfig.js,fckeditor.js,fckstyles.xml,fcktemplates.xml,fckeditor.php,fckeditor_php5.php,fckeditor_php4.php
七個檔案以外的所有檔案;
刪除目錄/editor/_source(基本上,所有_開頭的檔案夾或檔案都是可選的);
刪除/editor/filemanager/connectors/下除了php目錄的所有目錄;
刪除/editor/lang/下的除了 en.js, zh.js, zh-cn.js三個檔案的所有檔案。
3、開啟/FCKeditor/fckconfig.js
修改
var FCKConfig.DefaultLanguage = 'zh-cn' ;
var _FileBrowserLanguage = 'php' ;
var _QuickUploadLanguage = 'php' ;
要開啟檔案上傳的話,還需要配置editor\filemanager\connectors\php\config.php
將$Config['Enabled'] = false ;改為$Config['Enabled'] = true ;
更改$Config['UserFilesPath'] = '/userfiles/' ;為你的上傳目錄;
4.調用方法(例子)
將FCKeditor放在網站根目錄
在PHP檔案裡面,包含/FCKeditor/fckeditor.php檔案
//包含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
......................................................................................................................................................
<textarea name="content" style="display:none">這是文章內容測試!</textarea>
<?php
include_once("fckeditor/fckeditor.php");
$oFCKeditor=new fckeditor('content');
$oFCKeditor->BasePath='fckeditor/';
$oFCKeditor->value='default text in editor';
$oFCKeditor->Width='800px';
$oFCKeditor->Height='300px';
$oFCKeditor->create();
//$fck=$oFCKeditor->CreateHtml();
?>
......................................................................................................................................................
對於Fckeditor上傳中文名檔案時顯示亂碼的問題,現公布方法如下:
測試環境:php 5 , utf-8編碼
1、修正上傳中文檔案時檔案名稱亂碼問題
在檔案connectors/php/commands.php中尋找:
$sFileName = $oFile['name'] ;
在後面添加一行:
$sFileName = iconv("utf-8","gbk",$sFileName);
2、修本文件列表時中文檔案名稱顯示亂碼問題
在檔案connectors/php/util.php中尋找:
return ( utf8_encode( htmlspecialchars( $value ) ) ) ;
修改為:
return iconv('','utf-8',htmlspecialchars( $value ));
3、修正建立中文檔案夾時的檔案夾名亂碼問題
在檔案connectors/php/commands.php中尋找:
$sNewFolderName =
在後面添加一行:
$sNewFolderName = iconv("utf-8","gbk",$sNewFolderName);
2.6.3版及後續版本的fck下的html檔案已經加了utf-8的檔案頭。
文章出處:標準之路(http://www.aa25.cn/Tech/824.shtml)