现在的位置: 首页 > 综合 > 正文

在ASP中应用FCKeditor2.1.1

2013年04月22日 ⁄ 综合 ⁄ 共 1252字 ⁄ 字号 评论关闭

最近在项目中使用了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。

抱歉!评论已关闭.