Recommended: Database interface for domain name query asp version % on error resume next PRivate d_exsit Dim Retrieval Dim Domain Dim TakenHTML Function GetURL(url) Set Retrieval = Server.CreateObject(Microsoft.xmlHTTP) With Retrieval .Open GET, url, False, , .Send GetURL = .ResponseText End With Set Retrieval = N
1. Default language
Open the fckconfig.js file (relative to the FCKeditor folder, the same as below), change the automatic detection language to non-detection, and change the default language to Simplified Chinese:
Program code
FCKConfig.AutoDetectLanguage = false ;
FCKConfig.DefaultLanguage = 'zh-cn' ;
2. Font list
Open the fckconfig.js file and add the commonly used Song font; bold font; official script; regular font_GB2312 to the font list:
Program code
FCKConfig.FontNames = 'Song font; bold font; official script; Kai font_GB2312; Arial; Comic Sans MS; Courier New; Tahoma; Times New Roman; Verdana' ;
3. File upload
FCKeditor's file management program is divided into two types: browser and upload in the filemanager folder. Browsing means browsing server files and can choose or upload local files to the server; uploading means Quick Upload. Click the Upload tab in the window to open it. It is somewhat similar to the UBB editor we use. Just select the local file and upload it.
In other words, there is a file browsing in FCKeditor and two files uploads. Some of these settings are in one file, while others are in multiple files. It is quite complicated and has many changes. Let's talk about it in a few more points.
① Turn on and off file browsing and uploading functions
There are three files related to this switch, one is a js file and the two are an asp file. The former does not have relevant windows or buttons in the interface after closing, and the latter does not have relevant functions after closing.
First of all, the fckconfig.js file, set the following content to true to on, and false to off.
Upload functions in file browsing and browsing:
Program code
FCKConfig.LinkBrowser = false ;
FCKConfig.ImageBrowser = false ;
FCKConfig.FlashBrowser = false ;
Quick file upload function:
Program code
FCKConfig.LinkUpload = true;
FCKConfig.ImageUpload = true;
FCKConfig.FlashUpload = true;
Next, set two asp files:
editor/filemanager/browser/default/connectors/asp/config.asp
Program code
ConfigIsEnabled = False
Indicates that file browsing is closed
editor/filemanager/upload/asp/config.asp
Program code
ConfigIsEnabled = True
It means that the file is uploaded and opened quickly
②Display settings for file upload or browsing
Note that FCKeditor does not support virtual directories. All your paths are absolute paths to the root directory of the website. This is not convenient for developers who use virtual directories locally and publish them to remote website directories. That's mine. WinXP system can only have one site, and only use a virtual directory to represent different websites. After testing locally, this setting must be temporarily changed before uploading.
To browse the file, open the file editor/filemanager/browser/default/connectors/asp/config.asp:
Program code
ConfigUserFilesPath = /attachments/
To quickly upload the path, open the file editor/filemanager/upload/asp/config.asp:
Program code
ConfigUserFilesPath = /attachments/
My file directory is below http://127.0.0.1/temp/, so the settings are as follows. If you test this website locally in the virtual directory xxx, it should be set to:
Program code
ConfigUserFilesPath = /127.0.0.1/temp/
③ A source file bug for the file upload
After the above settings are made, file browsing and uploading can be smoothly carried out, but you will find that fast uploading cannot be used. The phenomenon is that after selecting the local file, there is no reaction after clicking the button uploading to the server. This is because of a bug in the fckconfig.js file.
Open the fckconfig.js file and replace the word FCKConfig.QuickUploadLanguage with _QuickUploadLanguage. There are three places to be replaced in total. The former is used without definition, so there is a mistake. According to the code intention, the value of the latter should be the same.
④Upload file name automatically renamed
FCKeditor does not support Chinese file names, so we need to change the name when saving the file to the server. Since there are two upload places and the files used are different, the two files should be modified at the same time. Let’s first look at the files that are uploaded quickly, open editor/filemanager/upload/asp/upload.asp, and add the following function at the end of the file:
Program code
Public Function GetNewFileName()
dim ranNum
dim dtNow
dtNow=Now()
randomize
ranNum=int(90*rnd)+10
GetNewFileName=year(dtNow) & right(0 & month(dtNow),2) & right(0 & day(dtNow),2) & right(0 & hour(dtNow),2) & right(0 & minute(dtNow),2) & right(0 & second(dtNow),2) & ranNum
End Function
We use year, month, day, hour, minute, second and two random numbers as file names, so that we can distinguish the file upload time and can not easily rename it.
Then there is still this file, find:
Program code
' Get the uploaded file name.
sFileName = oUploader.File( NewFile ).Name
Change it to:
Program code
' Get the uploaded file name.
sFileName = GetNewFileName() &.& split(oUploader.File( NewFile ).Name,.)
The above is a file that is uploaded quickly, while uploading during file browsing is to change another file (editor/filemanager/browser/default/connectors/asp/commands.asp). The modification method is the same as the file above: add a function and modify a line of code.
4. Reference FCKeditor editor in ASP source program
First, insert the server-side statement at the top of the asp page:
Program code
<!--#include file=FCKeditor/fckeditor.asp -->
Then add the following code to the form:
Program code
' Define variables
Dim oFCKeditor
' Initialization of the class
Set oFCKeditor = New FCKeditor
' Define the path (default path: /FCKeditor/)
oFCKeditor.BasePath=FCKeditor/
' Definition toolbar (default: Default)
oFCKeditor.ToolbarSet=Basic
' Define the width (default width: 100%)
oFCKeditor.Width=100%
' Define height (default height: 200)
oFCKeditor.Height=350
' Initial value of the input box
oFCKeditor.Value=This is the sample text.
' Create input box name: content
oFCKeditor.Create content
In this way, a hidden input box with the name content is created in the form, which can be used like other form elements, for example, use the following code to get the value of the input box:
Program code
Dim content
content=CheckStr(Request.Form(content))
The above uses CheckStr to detect the input data. If the original data contains single quotes or the like, an error will occur when updating the database.
Share: Common functions of ASP: LastDay() Program code % 'Function: determine whether a value exists in an array'Source: http://www.cncms.com/asp.asp Function InArray(sValue, aArray) Dim x InArray = False For Each x In aArray If x = sValue Then InArray = True Exit For End If Next End Function % Program code % 'Function: determine a