FCKeditor 2.6 installation and configuration User Guide (ASP)

Source: Internet
Author: User
FCKeditor To download the latest version:
Http: // www. FCKeditor . Net/
And other scripts Program Same, FCKeditor Is actually Source code . Follow the official method to create FCKeditor Release the downloaded package to this folder.
After the installation, it is configured and used. I only configure the general use (ASP environment), the source file is simplified, and complex applications do not care about it. Several files need to be modified during configuration. We divide the files by function instead of file, which makes it easier for readers to understand.

1. default language
Open the fckconfig. js file (relativeFCKeditorFolder), change the automatic detection language to not detect, and change the default language to simplified Chinese:

ProgramCode

Fckconfig. autodetectlanguage = false;
Fckconfig. defaultlanguage = 'zh-cn ';

2, Font list
Open the fckconfig. js file and add the frequently used "; _ GB" to the font list.2312":

Program code

Fckconfig. fontnames = '; _ GB2312; Arial; Comic Sans MS; Courier New; tahoma; Times New Roman; verdana ';

3. File Upload
FCKeditorIn the filemanager folder, file management programs can be divided into browser and upload. Browsing refers to browsing server files, selecting them, or uploading local files to the server. Uploading refers to quick upload. In the window, click the "Upload" tab to open it, similar to the UBB editor we use, select a local file and upload it.
That is to sayFCKeditorOne file is browsed and two files are uploaded. Some of these settings are in one file, while others are in multiple files. It's complicated and there are many changes. Let's talk about it in a few moments.

① Open and close the file browsing and uploading Functions
There are three files related to this switch. One is a JS file and the other is an ASP file. when the former is disabled, no related windows or buttons are displayed on the interface, and the latter is disabled and related functions are unavailable.
The first is the fckconfig. js file. The following content is set to true and false to off.
Upload in file browsing and browsing:

Program code

Fckconfig. linkbrowser = false;
Fckconfig. imagebrowser = false;
Fckconfig. flashbrowser = false;

Quick file upload:

Program code

Fckconfig. linkupload = true;
Fckconfig. imageupload = true;
Fckconfig. flashupload = true;

Set two asp files:
Editor \ filemanager \ browser \ Default \ connectors \ ASP \ config. asp

Program code

Configisenabled = false

Indicates that file browsing is disabled.

Editor \ filemanager \ browser \ Default \ connectors \ ASP \ config. asp

Program code
Configisenabled = true

Indicates that files are uploaded and opened quickly.

② File Upload
Upload path settings:
Open the file editor \ filemanager \ browser \ Default \ connectors \ ASP \ config. asp:

Program code

Configuserfilespath = "/userfiles /"

My file directory is in http: // www. ie521.com/userfiles.
If you test the website locally in the virtual directory test, set it:

Program code
Configuserfilespath = "/test/userfiles /"

Now let's test it. After clicking the "upload to server" button, there is no response. This is because the default language "php" is changed to "asp" in the fckconfig. js file ".

Program code

VaR _ filebrowserlanguage = 'php'; // ASP | aspx | CFM | lasso | Perl | PHP | py
VaR _ quickuploadlanguage = 'php'; // ASP | aspx | CFM | lasso | Perl | PHP | py

④ Automatic renaming of uploaded file names
FCKeditorChinese file names are not supported, so we need to change the name when saving the file to the server. Because there are two parts to be uploaded, and the files used are different, the two files should be modified at the same time. Let's take a look at the files uploaded quickly, open editor \ filemanager \ browser \ Default \ connectors \ ASP \ upload. ASP: Add the following functions at the end of the file:

I added this function under fileupload sresourcetype, scurrentfolder, and scommand ~

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 the year, month, day, hour, minute, and two random numbers as the file name, so that we can identify the File Upload time, and it is not easy to duplicate the name.

The file editor \ filemanager \ connectors \ ASP \ commands. asp is still displayed. Find:

Program code

'Get the uploaded file name.
Sfilename = ouploader. File ("newfile"). Name

Change it:

Program code

'Get the uploaded file name.
Sfilename = getnewfilename () & "." & Split (ouploader. File ("newfile"). Name, ".") (1)

Last step:
Reference in ASP source programFCKeditorEditor
Insert the server-side inclusion 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

Dim oFCKeditor'Define variables
Set oFCKeditor= NewFCKeditor'Class initialization
OFCKeditor. Basepath = "/FCKeditor/"'Defines the path (this is the root path :/FCKeditor/)
OFCKeditor. Basepath ="FCKeditor/"'Defines the toolbar (default: default)
OFCKeditor. Toolbarset = "Basic" 'defines the width (default width: 100%)
OFCKeditor. Width = "100%" 'defines the height (default height:200)
OFCKeditor. Height = 350 'the initial value of the input box
OFCKeditor. Value = "this is the sample text. "
OFCKeditor. Create"FCKeditor1"

In this way, an input box named "content" is created in the form and can be used like other form elements. For example, you can use the following code to obtain the value of the input box:

Program code

Dim content
Content = checkstr (request. Form ("FCKeditor1 "))

The checkstr function is a custom function that prevents illegal SQL characters from being contained. This custom function is also available in my blog: http: // www. ie521.com/blog/article.asp? Id = 440

Now you can implement basic functions. Of courseFCKeditorThe function is very powerful, so you need to study it slowly. '

-----
Note: All the above configurations are inFCKeditor 2. 6 tests.

Related links:FCKeditor 2. 6 when uploading an image, JavaScript reports an error: you do not have the permission to [solutions for all versions] http: // www. ie521.com/blog/article.asp? Id = 444

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.