在线编辑器的创建和使用
<?php
/*
*FCKeditor v2.6 lite3的类的创建及使用
*/
include('fckeditor.php'); //引入指向类的文件
$sBasePth = $_SERVER['PHP_SELP']; //获取当前文件路径
$sBasePth = dirname($sBasePath).'/'; //去掉路径的文件名,得到当前目录
$ed = new FCKeditor('myedit'); //创建FCKedior对象,并将其编辑器命名为myedit
$ed->BasePath=$sBasePath;
$ed->ToolbarSet='Default'; //将编辑器的模式设置为Default完整模式,若此处设值为Basic则为精简模式
if($_POST[submit]){
echo "标题:".$_POST[title];
echo"<br>";
echo "FCK内容:".$_POST[myedit]; //通过$_POST[myedit]就可以获取myedit编辑器中的数据
}
?>
<form action="" method="post">
标题:
<input type="text" name="title" value="<b>默认标题</b>">
<?php
$ed->Value="<B>阿阳的在线编辑器欢迎您使用哦^_^ "; //通过$ed->Value可以设置编辑器中的默认内容
$ed->Create(); //创建编辑器窗口
?>
<input type=submit name="submit" value="提交">
</form>
运行结果如下: