如何使用fckeditor在線編輯器
2024-05-04 11:05:52
供稿:網友
1、去http://www.aspprogram.cn/soft.asp?id=38這個地址下載fckeditor在線編輯器(請先殺毒,后使用)
2、fckeditor配置
a、為了使用根目錄,我們將IIS的默認網站設置為站點,指向fckeditor(這個可改名)所在的目錄。
b、現在建立一個asp文件,來調用fckeditor在線編輯器,假設為news.asp,代碼如下:
<!--#include file="FCKeditor/fckeditor.asp" -->
<%
a=request("a")
If a="" Then
%>
<table border=1 cellpadding=0 cellspacing=0>
<form name="form1" method="post" action="?a=save">
<tr>
<td align="right">新聞內容</td>
<td height="25" align="left">
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "/fckeditor/"
'設置編輯器的路徑,我站點根目錄下的一個目錄
'如果你改了目錄的名,這里就需要改成那個目錄名
oFCKeditor.ToolbarSet = "Default"
oFCKeditor.Width = "700"
oFCKeditor.Height = "500"
oFCKeditor.Value = ""
'這個是給編輯器初始值
oFCKeditor.Create "logbody"
'以后編輯器里的內容都是由這個logbody取得,命名由你定
%></td>
</tr>
<tr>
<td colspan=2 align="center">
<input type="submit" value=" 提 交 ">
</td>
</tr>
</form>
</table>
<%
Else '顯示fckeditor在線編輯器內容
response.write request("logbody")
End If
%>
到這里,可以上傳文字了
3、這個時候,我們在上傳圖片,出現上傳錯誤。解決方法:
(1)fckconfig.js 中修改
FCKConfig.DefaultLanguage = 'zh-cn' ; //原來是en
FCKConfig.TabSpaces = 1 ; //在編輯器中是否可以是否TAB鍵 0 不可用 1 為可用
var _FileBrowserLanguage = 'asp' ;
var _QuickUploadLanguage = 'asp' ;
(2) fckeditor.asp 中修改
sBasePath = "/fckeditor/"
'表示 當前這個文件 fckeditor.asp相對于站點根目錄的路徑,看看我的目錄排放
(3) FCKeditor/editor/filemanager/connectors/asp/config.asp中修改這里設置,用于文件上傳
ConfigIsEnabled = true '啟用上傳功能 把 false 改成 true
ConfigUserFilesPath = "/upFile/" '設置你的上傳目錄 這里 "/upFile/" 表示站點根目錄下的 upFile目錄 ,這個目錄是需要自己創建的,大家可以看到上圖目錄結構中我創建了 upFile 目錄 ,這樣上傳的文件將會存放到這個目錄中。FckEditor會根據您上傳的類別自動在upFIle目錄中創建如 image 、 flash 等目錄。
這樣就可以了,我們來試試index.asp程序,成功,可以上傳圖片了?。?!
(4) fckeditor/editor/filemanager/browser/default/connectors/asp/config.asp 中修改
這里設置,用于瀏覽服務器上文件
ConfigIsEnabled = true '啟用瀏覽功能,把false改成true
ConfigUserFilesPath = "/upfile/" 同(3)
完畢。