FCKeditor2.6.5及后续版本 for PHP配置及中文上传乱码解决!
作者:侯文斌 来源:hi.baidu.com 【大 中 小】 浏览: 添加日期:2009-11-13 我要评论(6)
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的文件头。

〖技术文档〗Tags: fck fckeditor 在线编辑器 fck编辑器
相关文章
更多评论(6)..会员评论
- 初学者(111.123.*.*) 发表于:2010-01-28 21:06:45
- 请问怎么用css控制文章里面的图片大小,是哪个CSS控制的,谢谢
- 管理员回复:宽度呀
- y147566714(60.176.*.*) 发表于:2010-01-28 17:17:58
- asp该怎么配置
- 管理员回复:到百度上搜索一下,应该很多的
- 萍儿(124.236.*.*) 发表于:2010-01-13 14:00:36
- 请问,fck在线编辑器要是回车换行的话行距太大 怎么解决?
- 管理员回复:请在css样式表里修改,找到它所关联的样式表,把p的外边距设置小一些
- Guest(222.216.*.*) 发表于:2009-12-06 12:22:21
- 哦,已经看到了,谢谢您的帮助.
- 管理员回复:不客气
- Guest(116.253.*.*) 发表于:2009-12-03 10:40:36
- 如果使用创建文件夹功能,中文文件夹名还是会有乱码,不知道可否将文件夹中文乱码问题一起补充一下,谢谢.
- 管理员回复:已经提供了解决办法啊呀,我这儿测试可以正常显示中文的
- Guest(58.17.*.*) 发表于:2009-11-17 16:30:42
- 站长这文章版面错位了
- 管理员回复:我知道,可能是部分内容代码被识别成页面代码了
推荐文章
热门文章
最新评论文章
推荐专题
在线交流QQ群
- 106310407(开)
- 55427134(开)
- 2993401(开)
- 30235673(开)
- 33424604(开)
- 2993401(开)
- 161512108(开)
- 161510519(开)
- 158375021(开)
- 155858414(开)
- 143309878(开)
- 16373807(开)
- 129098721(开)
- 123473199(开)
- 146991009(开)
- 135792800(开)
