Use of FCKeditor in ASP configuration Environment

Source: Internet
Author: User
Use of FCKeditor in ASP configuration Environment

Let's talk about the test environment: xpsp2, iis5.1, fckeditor2.0

Create a new site on IIS. I directly named it FCKeditor.

Create a site in DW. The test Server is a local machine and supports VBScript.

Download fckeditor2.0, which is open-source and can be found in many places on the Internet ......

The downloaded package should be compressed and decompressed to the root directory of the FCKeditor site. You can directly start calling the package without any changes. When you get there, you will find it easy to die!

Create an index. asp page under the root directory of the site, and add the following code in the Section (call the editor ):

<%
Dim ofckeditor
Set ofckeditor = new FCKeditor
Ofckeditor. basepath = "/FCKeditor/" // configure the editor path, a directory under the root directory of my site
Ofckeditor. toolbarset = "default"
Ofckeditor. width = "100%"
Ofckeditor. Height = "600"
Ofckeditor. value = "" // This is the initial value for the editor.
Ofckeditor. Create "logbody" // the content in the later editor is obtained by this logbody, And the name is determined by you.
%>

 

After adding this section, do not forget to add the second line before index. asp

<! -- # Include file = "FCKeditor/FCKeditor. asp" -->

Include FCKeditor. asp. Remember!

That's easy!

Now you only need to use this editor as a control to extract data from it: Request ("logbody ")

Now let's relax. The test is successful. There are some configurations in it. Go to the Internet and find some advanced instructions.

  FCKeditor usage

The following content is original, if you need to reprint, please indicate the source of http://3rgb.com Author: lemon garden master

FCKeditor version 2.0 has finally come out. The reason for using the word "final" is that the flash insertion function is widely seen in this version. It can be said that in any online editor, FCKeditor is now the best editor on the Internet. It has powerful functions, supports multiple browsers, and has no platform restrictions. It can be integrated with multiple web languages and supports multiple languages, open source, etc ~~

FCKeditor can directly use a brand new website without any modifications. However, for the vast majority of existing websites, some FCKeditor configurations are not suitable for your use. This article aims to tell you how to modify the FCKeditor to make it easier for your website to use.

The first task is to streamline the powerful editor. Of course, the document is simplified, not the function. Here, I will use the FCKeditor of ASP as an example to go to The FCKeditor 2.0 file folder and delete all file folders starting, examples or other tools are provided in these document folders. In fact, only the editor file folder and fckconfig are retained. JS, FCKeditor. ASP, FCKeditor. JS, fckstyles. XML, fcktemplates. XML is ready. The outermost layer is simplified. after entering the Editor folder, delete the "_ source" folder first. Here are some source documents, which are useless for use.

Go to the images file folder and delete the smiley file folder. Some documents contain emoticon icons. As I will use my own emoticon icons, I will delete them first. Of course, if you want to use the emojis here, do not delete them. Exit images and enter the Lang folder. The items here can be cleaned up. Only fck1_agemanager is retained. JS, zh-cn.js, en. JS, Zh. JS, the first of the four documents is the language configuration document, with which he can and fckconfig. the configuration in JS corresponds to the corresponding language documentation, zh-cn.js is a simplified Chinese Language Pack, en. JS is not required, Zh. JS is in Traditional Chinese. How is it? A few hundred KB is missing at once ~

Log out of the Lang folder and enter the skin folder. If you want to use the default FCKeditor yellow, delete the other two folders except the default folder. If you want to use other files, I will give you a suggestion. If you don't want to use the default one, select silver, because Silver is gray and it won't be ugly, however, the office2003 skin, which I like very much, is relatively large in size and adds download time!

In the last step of streamlining, exit the skin document folder and enter filemanager. If you are not using the latest FCKeditor version, you can use the file folder browser, and the new version has an upload document folder. One by one, first go to filemanager/Browser/default/connectors/. Because I use ASP, all files except ASP files are deleted. Then go to filemanager/upload/, and leave only the ASP document folder. Now, the simplified editor is complete. Next, modify the editor configuration.

The first modified file is the FCKeditor configuration file, which is located in the fckconfig. js file under the root directory. Please follow the list below (take FCKeditor 2.0 as the standard ):

Find row 20th fckconfig. defaultlanguage = 'en'; change to fckconfig. defaultlanguage = 'zh-cn'. Set the default language to simplified Chinese.

Find row 40th fckconfig. tabspaces = 0; change to fckconfig. tabspaces = 1; that is, you can use the tab key in the editor.

If your editor is still used at the front-end of the website, for example, for message book or diary reply, you have to consider security. Do not use the default toolbar on the front-end or customize the function, either use the basic defined by the system, that is, the basic toolbar,

Find row 64th fckconfig. toolbarsets ["Basic"] = [

['Bold ', 'italic', '-', 'orderedlist', 'unorderedlist', '-',/* 'link', */'unlink ', '-', 'style', 'fontsize', 'textcolor', 'bgcolor', '-', 'smiley ', 'specialchar', 'replace ', 'preview']

];

This is the basic I changed. I removed the image function and removed the Add link function, because the image and link and flash and image button adding functions allow the front-end page to directly access and upload documents, if I don't change it here, I will upload a Trojan to you. Isn't it ready? However, FCKeditor also supports the right-click function in the editing area.

Find row 73rd

Fckconfig. contextmenu = ['generic',/* 'link', */'anchor ',/* 'image', */'flash', 'select', 'textarea ', 'checkbox', 'Radio ', 'textfield', 'hiddenfield',/* 'imagebutton', */'call', 'bulletedlist', 'numberedlist', 'tablecell ', 'table', 'form'];

This is also the "link, image, Flash, image button" function that I changed to remove the right mouse button.

Find row 77th fckconfig. fontnames = 'arial; Comic Sans MS; Courier New; tahoma; Times New Roman; verdana ';

Add several common fonts fckconfig. fontnames = '; _ gb2312; Arial; Comic Sans MS; Courier New; tahoma; Times New Roman; verdana ';

After upload and upload. asp? Type = XX is changed to "type = YY", where "YY" wants to save the document folder name.

If you still want to use your own emoticon icon, you can jump to line 1 and change the folder address of the emoticon icon, along with the file name of the following emoticon icon, the three numbers below are the number of emotices displayed on each line and the width and height of the pop-up window. The size depends on the size of the window arranged by the emoticon icon. OK. The change to the configuration document is complete.

Next we will configure the editor location. My habit is to put the editor under the root directory, and the five documents mentioned at the beginning will also be under the root directory (TIPS: We recommend putting it under the root directory, we recommend that you use the absolute path, for example, "/FCKeditor/", and my usual configuration is "/". This will facilitate the update and upgrade of FCKeditor, in addition, any file folder on the website can be called at will. There is no problem where the name of another file folder has changed, and the editor cannot be used in other places.

Open the FCKeditor. asp document and find sbasepath = "/FCKeditor/" to sbasepath = "/"

Open the FCKeditor. js document and find this. basepath = '/FCKeditor/'; change this. basepath = '/';

The default display font in the editor is 12px, while the default font on my home page is 14px, which makes it quite uncomfortable. to modify the style sheet, you can modify it as needed, open/Editor/CSS/fck_editorarea.css and change row 4th to font-size: 14px.

The next step is to upload the configuration of the document. This is troublesome. Please perform this operation carefully.

Open/Editor/filemanager/Browser/default/frmresourcetype.html, find row 15th, and insert "['uploadfile', 'uploadfile']," in combination with fckconfig. for the configuration in JS, the path of my uploaded document is/uploadfile. Of course, you can change it to the file folder you want, but the name here must be the same as fckconfig. in JS, The YY in "type = YY" is consistent.

Before you finish, go to editor/filemanager/Browser/default/connectors/asp and open config. ASP: Change configisenabled = false to configisenabled = true. If you cannot upload a document, change configuserfilespath = "/userfile" to configuserfilespath = "/".

Add configallowedextensions. Add "uploadfile", "" after "set configdeniedextensions = Createobject (" scripting. Dictionary ",""

Configdeniedextensions. Add "uploadfile ",""

Similarly, the configuration here also corresponds to the above, together with fckconfig. js.

Another feature is quick upload. This feature is available only in FCKeditor 2.0 and is not available in previous versions. Go to/Editor/filemanager/upload/asp and open config. ASP, configure configisenabled = false to configisenabled = true, change configuserfilespath = "/userfiles/" to configuserfilespath = "/uploadfile/" & year (date () & "-" & month (date ()) & "/", because my uploaded documents are placed in the uploadfile folder and separated by month. Quick upload does not allow you to select a document folder, but directly upload the file through the configuration here. If the configuration here does not work well with the previous configuration, your documents will be uploaded in a mess, it is inconvenient to manage. Repeat the operations in the previous config. asp file before adding

Configallowedextensions. Add "uploadfile ",""

Configdeniedextensions. Add "uploadfile ",""

Next, let's talk about how to create your own online editor. Here we take ASP and JS as examples. The sample code of ASP is generally used for background operations:

<%
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 version, of course, can only be used in. ASP is the extension of the page, if you are in front of fckedito. if basepath is set to "/" in ASP, the third row can be saved. asp only has one create function. We recommend that you use ASP when modifying an article.

Next, let's look at the JS version:

<SCRIPT type = "text/JavaScript">
VaR ofckeditor = new FCKeditor ('logbody ');
Ofckeditor. basepath = '/';
Ofckeditor. toolbarset = 'basic ';
Ofckeditor. width = '000000 ';
Ofckeditor. Height = '20140901 ';
Ofckeditor. value = '';
Ofckeditor. Create ();
</SCRIPT>

  

The basepath configuration is described above. The JS version can be used on any webpage or even HTML page. Because it is generated by the client, the advantage is that it can reduce network traffic, because the editor document only needs to be downloaded once, and the second is the ability to define when to display it on the client. Because FCKeditor initialization takes some time, JS is very useful in this regard.

In addition, a more functional function of JS is the replacetextarea () function, which can replace the specified textarea and take the reply part of the log of my website as an example:

<SCRIPT type = "text/JavaScript">
<! --
Function showfck (){
VaR ofckeditor = new FCKeditor ('fbcontent ');
Ofckeditor. basepath = '/';
Ofckeditor. toolbarset = 'basic ';
Ofckeditor. width = '000000 ';
Ofckeditor. Height = '20140901 ';
Ofckeditor. value = '';
// Ofckeditor. Create ();
Ofckeditor. replacetextarea ();
// Document. blog_feedback.blogsubmit.disabled = '';
Document. blog_feedback.blogsubmit.style.display = '';
Document. blog_feedback.openfck.disabled = 'true ';
Document. blog_feedback.openfck.style.display = 'none ';
}
// -->
</SCRIPT>

Write it into a simple function. This FCKeditor is generated only when the user opens the editor. You do not need to initialize an editor every time you refresh the page, so the page speed will be much faster.

Supplement: As mentioned earlier, JavaScript version is not recommended when editing existing data content, which is caused by single quotation marks, it is inevitable that there will be single quotation marks in the data content. When an editor is generated using JS, the single quotation marks may cause the editor to fail to be generated normally. asp is different, the ASP version is used because the data is treated as a variable and then directly assigned to the editor domain. In addition, unless you use the replacetextarea () method to generate an editor, you do not need to write a tag such as <textarea>, and everything will be automatically generated by FCKeditor, all you need to do is to specify an Instance name for FCKeditor. At the same time, you do not have to worry about how to submit. FCKeditor will automatically submit the form when it is submitted. The submitted variable name is named after the FCKeditor instance you specified.

The latest version of FCKeditor is 2.3.1 ,:Http://www.fckeditor.net/download

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.