在 Drupal 中安裝 CKEditor ( 並外掛 syntaxhighlight )
  • 5,267 views,
  • 2013-10-21,
  • 上傳者: Kuann Hung,
  •  0
498ad7234d06e774795aea35488016ee.png
 
最近開始研究 Drupal,發現要安裝 CKEditor 還挺多步驟的。
這邊需要注意的是,如果直接在 Drupal 網站下載 CKEditor for Drupal 的話是要買授權的,所以如果要使用 open source 的話需要下載兩個不同的檔案然後自己合併。
步驟
1.
下載 CKEditor ( from Drupal.org, http://drupal.org/project/ckeditor )
我使用的是這個版本:http://ftp.drupal.org/files/projects/ckeditor-7.x-1.8.tar.gz
下載後先解在自己的電腦,然後在 ckeditor 下面還有一個 ckeditor 的目錄,要確認裡面有 "COPY_HERE.txt"
 
2.
下載 CKEditor core ( from ckeditor.com , http://ckeditor.com/download )
這裡要下載第一個 CKEditor,而不是下載 CKEditor for Drupal。我用的是這個:http://download.cksource.com/CKEditor/CKEditor/CKEditor%203.6.2/ckeditor_3.6.2.zip
下載後把他解開放入 ckeditor/ckeditor 。(可以刪除 _source 目錄) 
 
3.
下載 CKFinder (From ckfinder,  http://ckfinder.com/download)
 下載後存在 ckeditor/ 下。(可以刪除 _source 目錄)
    修改 sites/all/modules/ckeditor/ckfinder/config.php
    a. 移除驗證 (這是官方教的,不是破解喔!請參考目錄下的 README.txt)
        把 function CheckAuthentication() 註解掉。文件中有提到,不能直接改成 return true,否則會有安全性問題。
    b. 新增 config.php
        找到 $baseDir = resolveUrl($baseUrl); 並在下面新增
require_once '../../../../includes/filemanager.config.php';
4.
下載 syntaxhightlight
在這邊下載 http://code.google.com/p/ckeditor-syntaxhighlight/downloads/list
解開後放到 ckeditor/plugins 中。
 
5.
設定並上傳
修改 sites/default/settngs.php ,在前面加上以下兩行。
ini_set('memory_limit', '64M');
$cookie_domain = 'yourdomain.com';
然後把 ckeditor 整個目錄上傳到 sites/all/modules/ 中。
6.
設定 CKEditor
a. 設定權限
       在 Drupal 管理者介面中 [ 用戶 > 權限 ]
       允許 ADMINISTRATOR 存取
b. 設定 CKEditor 外掛
       在 Drupal 管理者介面中 [ 設定 > 內容撰寫 > CKEditor > 可在 Advance or Full 中設定 > 進階選項 > Custom JavaScript configuration ]
       加上
config.extraPlugins = 'syntaxhighlight';
config.toolbar_Full.push(['Code']);

c. 拉出 code button
         在 Drupal 管理者介面中 [ 設定 > 內容撰寫 > CKEditor > 可在 Advance or Full 中設定 > 進階選項 > Editor appearance ]
         在 All buttons 找到 [code] 並拉到 Used Buttons 中。
d. 設定 File Browser
         在 Drupal 管理者介面中 [ 設定 > 內容撰寫 > CKEditor > 可在 Advance or Full 中設定 > 進階選項 > File browser settings ]
         在 File browser type (Link dialog window) 中設定為 CKFinder 。
 
7.
大功告成!剩下就是測試了!
Facebook 討論區載入中...
資料夾 :
發表時間 :
2013-10-21 00:18:58
觀看數 :
5,267
發表人 :
Kuann Hung
部門 :
老洪的 IT 學習系統
QR Code :