天天看點

線上編輯器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