当前位置: 首页 > 图文教程 > 网络编程 > 网页编辑器 > php下FCKeditor2.6.5网页编辑器的使用方法

网页编辑器
DISCUZ论坛的UBB编辑器(增加灵活调用,支持ASP)
一款垃圾中的极品HTML编辑器(兼容IE OR FF)
一个Javascript 编写的代码编辑器
TinyMce 中文手册 在线手册与下载
eWebEditor_v280_Free_Final最好用的网页编辑器下载
新浪博客在线编辑器傻瓜调用版(2007.11.1第四次修正)提供下载了
解密FCKeditor 2.0 的设置.修改.使用方法
比较不错的修改FCKEditor的修改方法
FCKeditor2.3 For PHP 详细整理的使用参考
又一个不错的FCKeditor 2.2的安装、修改和调用方法
FCKeditor的几点修改小结
ASX文件 终极教程
DISCUZ论坛的UBB编辑器(增加灵活调用,支持ASP UBB解析)打包下载
Qzone编辑器QzoneEditor打包下载
FCKEditor v2.6 编辑器配置图解教程
asp.net 为FCKeditor开发代码高亮插件实现代码
宝丽通实现连续播放实现代码
jsp Ewebeditor使用说明
编辑器中designMode和contentEditable的属性的介绍
修改fckeditor的文件上传功能步骤

php下FCKeditor2.6.5网页编辑器的使用方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-10   浏览: 222 ::
收藏到网摘: n/a

php下FCKeditor2.6.5网页编辑器的使用方法,需要的朋友可以参考下。 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的文件头。
下面是一些补充
也许你经常进入网站的后台,或者发布文章什么的,你可以给你的文章添加不同的样式,不同的字体,什么的,也许你会想这是怎么做的呢,其实这很简单,只需要用下fckeditor这个小插件就可以实现,下面我们就看例子吧!
在fckeditor官方网站 上下载最新的源码,http://ckeditor.com/download 下载最新的fckeditor 源码包。
下载后就要配置了,源码包里面有fckeditor/_samples这个文件,这里面有写好的例子,可以直接运行,这样的话,你就可以参考这样的源文件,进行改写,需要注意的是,这里编辑器大部分都能用,上传图片却不能用,
下面配置上传图片功能。
打开文件FCKeditor/editor/filemanager/browser/default/connectors/php/config.php:
查找$Config['Enabled'],将它设置为'true';查找$Config['UserFilesPath'],将它设置图片的目录,这个目录是相对于主目录的。 也就是说,这个目录是相对于根目录的,注意,如果你在本机上测试,那么,这个根目录就是 http://localhost ,
这样基本配置已经写好了,下面就是我写的一个小例子,index.php
<Form name="form1" method="post" action="index.php" target="_blank">
<?php
//引用FCKeditor.php这个文件,基本的类和数据结构都在这里
include("fckeditor/fckeditor.php") ;
?>
<input id="content" name="content" value="" type="hidden" /> <iframe id="content___Frame" frameborder="0" height="100%" scrolling="no" width="100%" src="/test/bianyiqi/fckeditor/editor/fckeditor.html?InstanceName=content&Toolbar=Default"> </iframe>
<input name ="haiyang" value="明天第一时间我会更好" type="text" />
<input type="submit" name="submit" value="提交" />
</Form>
<?php
echo stripslashes($_POST['content']);
echo "<br/>";
echo $_POST['haiyang'];
?>
直接测试即可 ,注意,index.php 和fckeditor是在同一级目录下面的