因為大哥哥是用PHP,所以剛好這網頁有教PHP怎麼使用,不過只有教很基本的安裝與編輯環境介紹,並沒有進階的上傳圖片等功能,有需要在去找google大師吧!!

介紹如何安裝FCKeditor,安裝後如何使用PHP語法套到網頁上使用,如何傳遞資料(使用form標籤 GET 或 POST)

http://203.68.102.46/online_book/content.php?chapter_sn=225 <==這個也很詳盡,還有教怎麼開放上傳的設定喔!!

http://m955.com/wp/archives/76

FCKeditor 是一個強大的線上編輯器,它常常出現在我們的周圍,不過你應該沒發覺到,無名的編輯器就是採用 FCKeditor 系統,包括WP也有 FCKeditor 的編輯器外掛,它免費,可自由散佈,真是感謝作者這麼無私的提供了一套這麼好的軟體來供給我們使用!

如果今天我們心血來潮,想自己創造一個BLOG,那麼編輯器我首推 FCKeditor,其實它可以應用的地方很多,例如討論區的編輯器也可以採用,有很多方向可以思考。

來介紹一下 FCKeditor 的安裝方式吧!很難嗎?放心,安裝 FCKeditor 絕對比安裝 WP 簡單的多!

第一步:
先連到 FCKeditor 的官方網站下載最新的版本,官網也有多詳細的安裝及介紹資訊,如果你看的懂的話,我自己是看不懂,另外這裡有線上的 FCKeditor 展示,可以讓你先試用看看,不過我相信大家都很熟了。

第二步:
把下載回來的 FCKeditor 解壓縮到網站的根目錄下,FCKeditor 支援很多的版本安裝,如 ASP、JAVA、PHP...等,這裡使用的是 PHP 版本來做示範。在網頁中加入底下幾行參數:

PLAIN TEXT

PHP:

  1. <?php

  2. include("FCKeditor/fckeditor.php");

  3. $oFCKeditor = new FCKeditor('FCKeditor1');

  4. $oFCKeditor->BasePath = './FCKeditor/';

  5. $oFCKeditor->Value = '';

  6. $oFCKeditor->Width  = '50%';

  7. $oFCKeditor->Height = '500';

  8. $oFCKeditor->Config['SkinPath'] = 'skins/silver/';

  9. $oFCKeditor->ToolbarSet = 'myBasic';

  10. ?>

然後在你需要放編輯的的地方,通常是 <form> 裡,加入底下參數:

PLAIN TEXT

PHP:

  1. <?php $oFCKeditor->Create(); ?>

這樣就可以了開你的網頁來看看你剛剛做好的 FCKeditor ,沒錯!就是這麼簡單!

一些細部的地方還是需要設定一下!先來說說上面個參數的意義好了!

第一行 include("FCKeditor/fckeditor.php");
這是網頁一開始要嵌入的設定檔,這裡要注意一下路徑及資料夾檔名的問題,請按照你網站實際的情形修改。

第二行 $oFCKeditor = new FCKeditor('FCKeditor1');
這是設定編輯器的文章內容,所要存放的變數空間,等一下才可以用 $_POST['FCKeditor1']$_GET['FCKeditor1'] 來發送或是存取。

第三行 $oFCKeditor->BasePath = './FCKeditor/';
存放 FCKeditor 資料夾的原始路徑。也是要注意檔名及路徑的問題。

第四行 $oFCKeditor->Value = '';
這是設定編輯器一開始要顯示在編輯區塊的訊息,如果不希望有任何訊息顯示,保持空值即可。

第五、六行 Width、Height
這是設定編輯器的寬跟高。

第七行 $oFCKeditor->Config['SkinPath'] = 'skins/silver/';
這是設定面板佈景,FCKeditor 預設有三個面板可以更換,位置在 ./FCKeditor/editor/skins 裡,有 default、office2003、silver 三個可以選擇。

第八行 $oFCKeditor->ToolbarSet = 'myBasic';
這裡可以選擇按鈕的配置檔,設定檔在 ./FCKeditor/fckconfig.js 裡的 FCKConfig.ToolbarSets,預設有 [Default] [Basic] 可以選擇,不過 Default 的功能全開,會有安全性的疑慮,而 Basic 的功能又太少,所以我們可以在下面自訂一個功能列,然後在網夜裡使用這個指令呼叫。

而下面放在 <form> 這一行 <?php $oFCKeditor->Create(); ?> 是用來呼叫出 FCKeditor 的。

建立修改頁面

PLAIN TEXT

PHP:

  1. <?php

  2. require_once('Connections/fck.php');

  3. include("FCKeditor/fckeditor.php");

  4. $oFCKeditor = new FCKeditor('FCKeditor1')  ;

  5. $oFCKeditor->BasePath = './FCKeditor/';

  6. $oFCKeditor->Value = $row_Recordset1['content'];

  7. $oFCKeditor->Width  = '100%';

  8. $oFCKeditor->Height = '500';

  9. $oFCKeditor->Config['SkinPath'] = 'skins/silver/';

  10. $oFCKeditor->ToolbarSet = 'myBasic';

  11. ?>

  12. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  13. <html>

  14. <head>

  15. <meta http-equiv="Content-Type" content="text/html; charset=big5">

  16. <title>編輯</title>

  17. </head>

  18. <body>

  19. <form method="POST" action="<?php echo $editFormAction; ?>" name="edit">

  20. <table width="80%"  border="1" align="center" cellpadding="4" cellspacing="2">

  21.   <tr>

  22.     <td>主題</td>

  23.     <td><input name="subject" type="text" id="subject" value="<?php echo $row_Recordset1['subject']; ?>" size="50"></td>

  24.   </tr>

  25.   <tr>

  26.     <td>時間</td>

  27.     <td><input name="date" type="text" id="date" value="<?php echo $row_Recordset1['date']; ?>"></td>

  28.   </tr>

  29.   <tr>

  30.     <td colspan="2">

  31. <?php $oFCKeditor->Create(); ?>

  32.       <input name="content" type="hidden" id="content" value="<?php echo $row_Recordset1['content']; ?>"></td>

  33.   </tr>

  34.   <tr>

  35.     <td colspan="2"><input type="submit" name="Submit" value="送出">

  36.       <input name="on" type="hidden" id="on" value="<?php echo $row_Recordset1['on']; ?>"></td>

  37.   </tr>

  38. </table>

  39. <input type="hidden" name="MM_update" value="edit">

  40. </form>

  41. </body>

  42. </html>

  43. <?php

  44. mysql_free_result($Recordset1);

  45. ?>

標籤: FCKeditor, PHP, 網頁

arrow
arrow
    全站熱搜

    NoMoney NoHoney 發表在 痞客邦 留言(0) 人氣()