Another good method to install, modify, and call FCKeditor 2.2

Source: Internet
Author: User

I was surprised to find that my blog's FCKeditor could not be used! Even if pjblog is optimistic, it will not work. Go to the Internet and copy some of the main items. The main content is as follows:
FCKeditor Official Website: www.fckeditor.com
And other scripts Program Similarly, FCKeditor installation is actually Source code .
Follow the official method to create a folder such as FCKeditor under the root directory of the website,
Then release the downloaded package to this folder.
Only common use (ASP environment) configuration and source file streamlining.

1. default language
Open the fckconfig. js file (the same as the FCKeditor folder), change the automatic detection language to not detect, and change the default language to simplified Chinese:CopyCodeThe Code is as follows: fckconfig. autodetectlanguage = false;
Fckconfig. defaultlanguage = 'zh-cn ';

2. Font list
Open the fckconfig. js file and add the frequently used "; _ gb2312" to the font list ":Copy codeThe Code is as follows: fckconfig. fontnames = '; _ gb2312; Arial; Comic Sans MS; Courier New; tahoma; Times New Roman; verdana ';

3. File Upload
The file management program of FCKeditor is in the filemanager folder and 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 say, FCKeditor has a file browsing 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.

1) Enable and disable file browsing and uploading
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:Copy codeThe Code is as follows: fckconfig. linkbrowser = false;
Fckconfig. imagebrowser = false;
Fckconfig. flashbrowser = false;

Quick file upload:Copy codeThe Code is as follows: fckconfig. linkupload = true;
Fckconfig. imageupload = true;
Fckconfig. flashupload = true;

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

Copy codeThe Code is as follows: configisenabled = false

Indicates that file browsing is disabled.

Editor \ filemanager \ upload \ ASP \ config. asp

Copy codeThe Code is as follows: configisenabled = true

Indicates that files are uploaded and opened quickly.

2) File Upload or browsing path settings
Note that FCKeditor does not support virtual directories. All your paths are absolute paths for the root directory of the website, it is not convenient for developers to publish to remote website directories. In this case, the WINXP system can only have one site, and only use virtual directories to represent different websites. After testing locally, you must temporarily change this setting before uploading.
File browsing path. open the file:
Editor \ filemanager \ browser \ Default \ connectors \ ASP \ config. asp

Copy code The Code is as follows: configuserfilespath = "/Attachments /"

Quick upload path, open the file: Editor \ filemanager \ upload \ ASP \ config. asp

Copy codeThe Code is as follows: configuserfilespath = "/Attachments /"

My file directory is located at http://www.xxx.com/attachments.
If you test the website locally in the virtual directory XXX, set it:Copy codeThe Code is as follows: configuserfilespath = "/XXX/Attachments /"

3) A source file bug for Fast File Upload
After the preceding settings are complete, you can smoothly upload files during file browsing and browsing, but you will find that "quick upload" is unavailable. After selecting a local file, click "upload to server" without any response. This is because of a bug in the fckconfig. js file.
Open the fckconfig. js file, replace the fckconfig. quickuploadlanguage with _ quickuploadlanguage, and replace it with three places in total. The former is used without definition, so there is a mistake. The Code intent should be the same as the latter value.

4) automatically rename the uploaded file name
FCKeditor does not support Chinese file names, 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 to be uploaded quickly and open: Editor \ filemanager \ upload \ ASP \ upload. ASP: Add the following functions at the end of the file:

Copy code The Code is as follows: 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.
Then the file is still located. Find:Copy codeThe Code is as follows: 'Get the uploaded file name.
Sfilename = ouploader. File ("newfile"). Name

Change it:Copy codeThe Code is as follows: 'Get the uploaded file name.
Sfilename = getnewfilename () & "." & Split (ouploader. File ("newfile"). Name, ".") (1)

The above is a fast upload file, while the upload in the file browsing is to change another file (editor \ filemanager \ browser \ Default \ connectors \ ASP \ commands. ASP), the modification method is the same as the above file: Add a function and modify a line of code.

4. Reference The FCKeditor editor in the ASP source program.
Insert the server-side inclusion statement at the top of the ASP page:

Copy code The Code is as follows: <! -- # Include file = "FCKeditor/FCKeditor. asp" -->

Then add the following code to the form:Copy codeThe Code is as follows:

'Define variables
Dim ofckeditor
'Class initialization
Set ofckeditor = new FCKeditor
'Define the path (default path:/FCKeditor /)
Ofckeditor. basepath = "FCKeditor /"
'Define toolbar (default)
Ofckeditor. toolbarset = "Basic"
'Define the width (default width: 100%)
Ofckeditor. width = "100%"
'Defines the height (default Height: 200)
Ofckeditor. Height = 350
'Initial value of the input box
Ofckeditor. value = "this is the sample text. "
'Create an input box named: Content
Ofckeditor. Create "content"

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:

Copy code The Code is as follows: dim content
Content = checkstr (request. Form ("content "))

The preceding Code uses checkstr to check the input data. If the original data contains single quotation marks, an error occurs when updating the database. ============================================
There are also some questions:
1. The file upload path is difficult, but it will not be improved after reading the version.
2, linkbrowser and linkupload do not understand what it means (UP2006-3-20: the original inserted hyperlink, the link of the target file can also be uploaded, by default, this file format only specifies the format that cannot be uploaded. In fact, we can use this function to upload files in rar, Doc, and other formats)

When inserting a hyperlink, the official default configuration only specifies the format of the prohibited upload, rather than specifying the format that allows the upload as in the image or Flash format. Pay special attention to this, so what you see is that you can upload "any" type of files. Follow the configuration file:

Copy code The Code is as follows: fckconfig. linkuploaddeniedextensions = ". (PhP | php3 | PhP5 | phtml | ASP | aspx | ascx | JSP | CFM | CFC | PL | bat | exe | DLL | Reg | CGI) $ "; // empty for no one

Except for these disallow, all others are allowed.

To remove the Insert Form option, modify the following section of fckconfig. js (comment the line of Form ):

Copy code The Code is as follows: fckconfig. toolbarsets ["default"] = [
['Source', 'docprops', '-', 'save', 'newpage', 'preview', '-', 'templates'],
['Cut ', 'copy', 'paste', 'pastetext ', 'pasteword','-', 'print', 'spellcheck'],
['Undo ', 'redo', '-', 'Find ', 'replace', '-', 'selectall', 'removeformat'],
['Bold ', 'italic', 'underline', 'strikethangout', '-', 'subscript', 'superscript'],
['Orderedlist', 'unorderedlist', '-', 'outdent ', 'indent'],
['Justifyleft', 'justifycenter', 'justifyright', 'justifyfull'],
['Link', 'unlink', 'anchor '],
['Image', 'flash', 'table', 'rule', 'smilil', 'specialchar ', 'pagebreak', 'universalkey'],
// ['Form', 'checkbox', 'Radio ', 'textfield', 'textta', 'select', 'click', 'imagebutton ', 'hiddenfield'],
'/',
['Style', 'fontformat', 'fontname', 'fontsize'],
['Textcolor', 'bgcolor'],
['About']
];

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.