最近在項目中使用了FCKeditor的最新版,有一些問題值得注意,現在寫出來供大家參考。
1. asp頁面使用GB2312編碼。
2. 下載FCKeditor2.1.1。
3. 將FCKeditor2.1.1解壓縮到項目的根目錄下,目錄結構為:\項目名\FCKeditor\ 。
4. 修改 \項目名\FCKeditor\editor\filemanager\browser\default\connectors\asp\config.asp 和 \項目名\FCKeditor\editor\filemanager\upload\asp\config.asp 這兩個檔案,將ConfigIsEnabled變數的值均改為True,以允許上傳功能,後者用於設定快速上傳;將ConfigUserFilesPath變數的值均設為\upload\,這樣上傳檔案存到 \項目名\upload\目錄下的子目錄中。
5. 修改 \項目名\FCKeditor\editor\filemanager\browser\default\connectors\asp\connector.asp 和 \項目名\FCKeditor\editor\filemanager\upload\asp\upload.asp 這兩個檔案,將檔案中第一行<%@ CodePage=65001 Language="VBScript"%>中的 CodePage=65001 去掉,這一步非常關鍵,否則使用GB2312時會產生亂碼(感謝戰友HHH3000)。
6. 上傳的檔案不支援中文檔案名稱,要解決這個問題,可用editplus將FCKeditor所有檔案中的utf-8替換成gb2312即可,是否有副作用目前還未可知。
7. 在asp中添加如下代碼建立線上編輯器:
在頁面的頂部加入<!--#include file="/FCKeditor/fckeditor.asp"-->
在適當的位置加入下面代碼
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
'oFCKeditor.BasePath = "/FCKeditor/" ' 設定editor目錄在項目中的位置
oFCKeditor.ToolbarSet = "Default"
oFCKeditor.Width = "550"
oFCKeditor.Height = "400"
oFCKeditor.Value = "" ' oFCKeditor.Value = rs("content") 修改內容
oFCKeditor.Create "content"
%>
8. 經過上面步驟就可以在asp中使用FCKeditor了,關於FCKeditor的更多設定可參見下面的文章:
FCKeditor 2.0線上編輯器的設定與修改以及使用
FCKeditor2.0線上編輯器的修改與設定-檔案上傳部分管理部分
隨後將帶來在JSP中應用FCKeditor。