PHP中使用FCKeditor2.3.2配置


  FCKeditor2.3.2在线编辑器十分好用, 彻底 支撑文件上传 。今日baidu了一下午终于搞定了 。 下载FCKeditor2.3.2,解压至FCKeditor 。

  1首先删除 毋庸要的文件 节俭空间 。 但凡以_开头的文件如_samples,_testcases和一些用不到的.asp、.jsp、.cfm文件 通通干掉 。

2 批改fckconfig.js

FCKConfig.AutoDetectLanguage = true ;//是不是自动检测语言

FCKConfig.DefaultLanguage  = 'zh-cn' ;//设置语言

FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ;//设置皮肤

FCKConfig.TabSpaces = 1 ;//tab是不是有效

FCKConfig.ToolbarStartExpanded = true ;//编辑工具条是不是浮现,等点“展 动工具栏”时才浮现

FCKConfig.FontNames  = '宋体;黑体;隶书;楷体_GB2312;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ;//增加中文字体

批改FCKeditor\editor\CSS\fck_editorarea.css

设置默许字体及大小

body, td

{

 font-family: Arial, Verdana, Sans-Serif;

 font-size: 14px;

}

3对于文件上传的设置

批改fckconfig.js

var _FileBrowserLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php

var _QuickUploadLanguage = 'php' ; // asp | aspx | cfm | lasso | php

批改fckeditor\editor\filemanager\browser\default\connectors\php

$Config['Enabled'] = true ;

$Config['UserFilesPath'] = '/UserFiles/' ;//设置上传的文件夹,可自己指定

批改fckeditor\editor\filemanager\upload\php

$Config['Enabled'] = true ;

$Config['UseFileType'] = true ;

$Config['UserFilesPath'] = '/UserFiles/' ;//同上要一样

4引入在线编辑器时 惟独

<?php

include("fckeditor/fckeditor.php") ;

$oFCKeditor = new FCKeditor('FCKeditor1') ;//实例化

$oFCKeditor->BasePath = 'fckeditor/';//这个路径 定然要和上面那个引入路径 统一,不然会报错:找不到fckeditor.html页面

//$oFCKeditor->Value = '' ;

$oFCKeditor->Width = '100%' ;

$oFCKeditor->Height = '300' ;

$oFCKeditor->Create() ;

?>

JS用alert( FCKeditorAPI.GetInstance('FCKeditor1').GetXHTML( true ))得到FCKeditor1的值;

PHP用$_POST['FCKeditor1']得到FCKeditor1的值 。