PHP 实例:FCKeditor 的配置和使用方法
FCKeditor 是一个十分强大的网页文本编辑器,它支持多种脚本编程语言(
包括 PHP)和支
持多国语言。
FCKeditor
截至 2008 年 4 月 6
日,其最新版本是 2.6RC,RC
就是 Release Candidate,修订
后的候选版本,很可能作为该版本的稳定版在未来发布。目前的最新的稳定版(Latest
Stable)
是 2.5.1
。我们可以到他的官方网站上去下载 http://www.FCKeditor.net 合适的版本,
开源、免费的。
本文介绍 PHP 中的配置方法,其他语言的配置方法和它是基本一样的。
〇、假设网站的目录为:
以下为引用的内容:
\website_root
\index.php
\FCKeditor
一、调用 FCKeditor 的两种方法
1、通过创建实例来调用
在 index.php 文件中,调用它的代码,把下面的代码加在需要编辑器的地方:
以下为引用的内容:
<Form name="frm1">
<?php
//引用 FCKeditor.php 这个文件,基本的类和数据结构都在这里
include_once("FCKeditor/fckeditor.php");
//创建 FCKeditor 对象的实例。myFCKeditor 即提交后,接收数据页面
_POST['myFCKeditor']使用
FCKeditor=new FCKeditor('myFCKeditor');
//FCKeditor 所在的位置,这里它的位置就是'FCKeditor' 文件夹
FCKeditor->BasePath='./FCKeditor/';
//工具按钮设置
FCkeditor->ToolbarSet='Default';
//设置它的宽度
FCKeditor->Width='100%';
//设置它的高度
FCKeditor->Height='300px';
//生成
FCkeditor->Create();
?>
</Form>