2016年3月17日 星期四

安裝FCKeditor2.6.6線上編輯器心得

請下載FCKeditor官方網站http://ckeditor.com/download下載
  1. 解壓縮後,置於網站內.
  2. 修改fckeditor\fckconfig.js,改變FCKeditor工具列圖示
    FCKConfig.ToolbarSets["Default"] = [
        ['Source','Preview'],
        ['Cut','Copy','Paste','PasteText','PasteWord','-','SpecialChar','PageBreak'],
        ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
        ['FitWindow','-','About'],
        '/',
        ['Bold','Italic','Underline','StrikeThrough'],
        ['OrderedList','UnorderedList','-','Outdent','Indent'],
        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
        ['Link','Unlink'],
        ['Image','Flash','Table','Rule','Smiley'],
        '/',
        ['FontFormat','FontName','FontSize'],
        ['TextColor','BGColor','-','Subscript','Superscript']
    ] ;
  3. 修改fckeditor\fckconfig.js,改變表情符號為相對位址
    FCKConfig.SmileyPath = FCKConfig.BasePath + 'images/smiley/msn/' ;
    改為 FCKConfig.SmileyPath = '/fckeditor/editor/images/smiley/msn/' ;
  4. 檔案上傳功能啟用
    • fckeditor/editor/filemanager/connectors/php/config.php
      • $Config['Enabled'] = true ;
      • $Config['UserFilesPath'] = '/upfiles/' ; <--底下還有file,image,flash,media四個資料夾須建立
      • $Config['UserFilesAbsolutePath'] = '/webs/wles5/upfiles/' ;
    • 讓exe執行檔也能上傳
      • fckeditor\editor\filemanager\connectors\php\config.php
        $Config['AllowedExtensions']['File']    = 加上 , 'exe'
      • fckeditor\fckconfig.js
        FCKConfig.LinkUploadAllowedExtensions    = 加上 |exe
  5. 啟用FCKeditor系統(自建function)
    function getFCK($content='',$object='content',$height='480px') {
        include('./fckeditor/fckeditor.php');  //載入fckeditor套件
        $oFCKeditor = new FCKeditor($object) ; //建立fckeditor物件
        $oFCKeditor->BasePath  = './fckeditor/'; //設定fckeditor物件基本路徑
        $oFCKeditor->Width = '640px'; // fckeditor物件的長
        $oFCKeditor->Height = $height; //fckeditor物件的寬
        $oFCKeditor->Value = $content; //預設內容
        //$oFCKeditor->Create();
        return $oFCKeditor;
    }