FCKeditor 實作 PHP

FCKeditor 實作 PHP

將下載完後的FCKeditor解壓縮放在想要放的網站內,

接著在程式碼內放入FCKeditor程式,下面程式碼僅為片段程式碼

建立 introduction.php

<form action="introductionEdit.php" method="post">                   
     <div class="newsbox_content">
        <!-- News Text -->    
        <?php
            include("plugin/fckeditor/fckeditor.php") ;//將路徑指到FCKeditor資料夾內的fckeditor.php
            $sBasePath = $_SERVER['PHP_SELF'] ;//網站伺服器路徑

            $oFCKeditor = new FCKeditor('content') ;//建立FCKeditor
            $oFCKeditor->BasePath = 'plugin/fckeditor/';//將路徑指到存放FCKeidtor的位置
            $oFCKeditor->Width = '100%';//設定編輯器的寬
            $oFCKeditor->Height = '300px';//設定編輯器的高
            $oFCKeditor->Value  = $row_introduce['content'];//設定編輯器的內容,這邊$row_introduce['content']是抓資料庫的資料,可自行輸入和修改
            $oFCKeditor->Create() ;//建立FCKeditor
         ?>
                    
         <div style="text-align:center;">
             <label>
                <input type="submit" name="submit" id="submit" value="送出" />
             </label>
             <label>
                <input type="reset" name="reset" id="reset" value="重設" />
             </label>
         </div>              
     </div>
</form>

 

建立處理 introduction.php程式introductionEdit.php

請記得先到introduction.php程式的form標籤,設定action="introductionEdit.php" method="post"

<?

        echo  $_POST['content'];//顯示建立在編輯器框框的內容,$_POST['這邊要輸入在 introduction.php裡面 new FCKeditor('這邊的名稱')']

?>

 

 

參考或是複製語法時,別忘了留個言喔 ^ ^ ~