天天看点

在线编辑器fckeditor应用

在线排版,方便用户编辑操作,将图片,文字等生成对应的HTM代码的编辑器

fckeditor配置

$sBasePath = $_SERVER['PHP_SELF'];

$SBasePath = dirname($sBasePath).'/';//取得路径的函数

$oFCKeditor = new FCKeditor('FCKeditor1');

$oFCKeditor->BasePath = $sBasePath;//这个路径一定可以找到fckeditor.php

fckeditor的应用

$oFCKeditor->Create();//创造一个窗口出来

$oFCKeditor->Value='初始值';

提交时,直接使用实例化时的名称"FCKeditor1"

使用时,将插件包放到开发目录中,一个小例子

<?

include("fckeditor/fckeditor.php");

$sBasePath = $_SERVER['PHP_SELF'];

$sBasePath = dirname($sBasePath);

$ed=new FCKeditor('testEditor');

$ed->BasePath = $sBasePath;//这个路径一定可以找到fckeditor.php

if($_POST['sub']){

echo "标题".$_POST[title];

echo "内容".$_POST[testEditor];

}

?>

<form action="" method="post">

<input type="text" name="title" value="输入标题"/>

<?php

$ed->Value="初始值";

$ed->Create();

?>

<input type="submit" name="sub" value="提交信息"/>

</form> 

http://www.php100.com/html/webkaifa/PHP/PHPyingyong/2009/0412/275.html