FCKeditor在ASP环境中配置使用
而如果你还想用自己的表情图标的话,那跳到131行,改掉那个表情图标的文件夹地址,以及下面的表情图标的文件名,再下面那三个数字是每行显示表情数及弹出窗口的宽和高了,这个的大小要根据您的表情图标排列的窗口的大小而定了。OK,总配置文件修改结束。
接下来是编辑器位置的设置,我的习惯是把editor放在根目录下,最开始所述的五个文件也放在根目录下(Tips:建议放在根目录下,并且建议使用时设置路径也采用绝对路径,如"/fckeditor/",而我的习惯的设置是"/"),这样有利于fckeditor的更新升级,并且网站下所有文件夹都可以任意调用,不存在其它文件夹名变了而其它地方就无法使用编辑器的问题。
打开fckeditor.asp文件,找到 sBasePath = "/fckeditor/"改为 sBasePath = "/"
打开fckeditor.js文件,找到 this.BasePath = '/fckeditor/' ;改为 this.BasePath = '/' ;
编辑器域内默认的显示字体为12px,而我的主页默认字体为14px,所以看着就很不舒服,想要修改可以通过修改样式表来达到要求,打开/editor/css/fck_editorarea.css,把第4行改为 font-size: 14px;即可。
接下来就是上传文件的设置了,这个比较麻烦,请仔细操作。
打开\editor\filemanager\browser\default\frmresourcetype.html,找到第15行,插入“ ['uploadfile','uploadfile'],”配合上刚才在fckconfig.js里的设置,那么我的上传文件路径就是/uploadfile,当然你也可以改成你想要的文件夹,但这里的名称一定要和fckconfig.js里的那个“Type=YY”里的YY一致才行。
还没完,继续进入到editor\filemanager\browser\default\connectors\asp,打开config.asp,先把ConfigIsEnabled = False改成为ConfigIsEnabled = True,要不是没法上传文件的,再把ConfigUserFilesPath = "/UserFile"改成我想要的ConfigUserFilesPath = "/"。
接着在“Set ConfigDeniedExtensions = CreateObject( "Scripting.Dictionary" )”后面加入ConfigAllowedExtensions.Add "uploadfile", ""
ConfigDeniedExtensions.Add "uploadfile", ""
同理,这里的设置也是要和上面以及fckconfig.js里面对应的。
还有一个上传,就是快速上传,这个功能是在fckeditor 2.0里才有的,以前的版本没这个功能。进入\editor\filemanager\upload\asp,同样打开config.asp,也同样的把ConfigIsEnabled = False 设置成 ConfigIsEnabled = True,我这里把ConfigUserFilesPath = "/UserFiles/"改成我想要的 ConfigUserFilesPath = "/uploadfile/"& Year(Date()) &"-"& Month(Date()) &"/",因为我的上传文件是放在uploadfile文件夹下,并且是按月分开放置的。快速上传,不会让你选择文件夹,而是通过这里的设置直接上传的,这儿设置如果和前面的设置配合不好的话,你的文件就会被上传得乱七八糟,很不方便管理。接前重复前一个config.asp里的操作,在后面加上
ConfigAllowedExtensions.Add "uploadfile", ""
ConfigDeniedExtensions.Add "uploadfile", ""
接下来呢,就讲一下如何创建自己的在线编辑器,这里以ASP和JS版的为例,ASP版示例代码,一般用于后台操作:
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "/"
oFCKeditor.ToolbarSet = "Default"
oFCKeditor.Width = "100%"
oFCKeditor.Height = "400"
oFCKeditor.Value = rs("logbody")
oFCKeditor.Create "logbody"
%>
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "/"
oFCKeditor.ToolbarSet = "Default"
oFCKeditor.Width = "100%"
oFCKeditor.Height = "400"
oFCKeditor.Value = rs("logbody")
oFCKeditor.Create "logbody"
%>
ASP版的,当然只能用在以.asp为扩展名的页面中,如果你在前在fckedito.asp里设置过BasePath为"/"的话,这里就可以省掉第三行,ASP版的只有一个Create函数。建议在修改一篇内容时用ASP版的。
接下来看JS版的:
<script type="text/javascript">
var oFCKeditor = new FCKeditor( 'logbody' ) ;
oFCKeditor.BasePath = '/' ;
oFCKeditor.ToolbarSet = 'Basic' ;
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '400' ;
oFCKeditor.Value = '' ;
oFCKeditor.Create() ;
</script>
BasePath的设置同上所述,JS版的可用于任何网页中,甚至用于html页面,因为其是客户端生成的,这样的好处就是一可以减小网络流量,因为编辑器文件只需下载一次,二是可以由客户端定义什么时候显示,由于fckeditor初始化需要一定时间,在这一点上JS就很有作用了。
另外,JS版的还有一个功能函数就是ReplaceTextarea()函数,可以替换指定的TextArea,拿我的网站的日志的回复部分示例:
<script type="text/javascript">
<!--
function showFCK(){
var oFCKeditor = new FCKeditor( 'fbContent' ) ;
oFCKeditor.BasePath = '/' ;
oFCKeditor.ToolbarSet = 'Basic' ;
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '200' ;
oFCKeditor.Value = '' ;
//oFCKeditor.Create() ;
【发表评论】【打印此文】【关闭窗口】【点击数: 】
