Original article: http://www1.biochems.cn/63.htm
I abandoned FreeTextBox1.6 Chinese version yesterday and switched to FCKeditor 2.1.1. FCKeditor not only supports FLASH insertion, but also has excellent compatibility: supports a variety of browsers, including IE 5.5 +, Firefox 1.0 +, Mozilla 1.3, and Netscape 7 +. It has no platform restrictions, it can run on Windows, Mac, and Linux. It can be integrated with multiple WEB languages, including ASP. net, ASP, PHP, ColdFusion, Java, Perl; 47 language packs are supported in multiple languages; open source and free; the most important thing is to support the XHTML1.0 standard.
For ASP websites, FCKeditor can be used directly without any modifications, because FCKeditor is ASP by default. However, some settings are not suitable for your own use. Yesterday, FCKeditor was simply modified for use on ASP. NET websites for reference only.
I. Preparations
First download the latest FCKeditor V2.1.1,: http://sourceforge.net/project/showfiles.php? Group_id = 75348 & package_id = 75845; this compressed package does not contain ASP. NET to use DLL controls, so also download another compressed package,: http://sourceforge.net/project/showfiles.php? Group_id = 75348 & package_id = 137125. Decompress the first file to the WEB root directory. The default folder is FCKeditor. decompress the second package, which contains the source code. If you want to develop the file again, double-click FredCK. FCKeditorV2.csproj file, open.. NET. The language used is C #. If you do not want to modify it, directly change the FredCK under bin \ Release. copy the FCKeditorV2.DLL file to the bin in the WEB directory.
Ii. Streamline files
Because only ASP. NET is used, it is necessary to streamline the file.
Go to the FCKeditor folder and delete all files and folders starting with "_". These are examples. Only the editor folder and fckconfig are retained. js, fckeditor. js, fckstyles. xml, fcktemplates. xml is enough;
Go to the editor folder and delete the "_ source" folder, which also contains the source file;
Go back to the upper-level directory and enter the filemanager folder. There are two folders: browser and upload. Go to browser \ default \ connectors. Only the aspx folder is retained, and the rest are deleted. The mcpuk directory can also be deleted. The same is true for upload, and only the aspx folder is retained;
Return to the editor and enter the images folder. The smiley folder contains emoticon icons, including msn and fun. If you want to use your own emoticon icons, you can delete them; if you want to use the emojis here, do not delete them;
Lang contains a Language Pack. If only simplified Chinese characters are used, only fck1_agemanager is retained. js, zh-cn.js two files on the line, it is recommended to keep en. js (English), zh. js (Traditional Chinese) files, fck1_agemanager. js is a language configuration file. With it, it can be used with fckconfig. js settings are paired, corresponding to the corresponding language file, must be retained!
Exit the lang folder and enter the skins folder. If you want to use the default FCKeditor milk yellow, delete the other two folders except the default folder. If you want to use other folders, it depends on your preferences.
So far, the file has been streamlined, from the original 2.55M to the current 797K. Then modify the settings.
3. Modify settings
Open the fckconfig. js file in the root directory.
FCKConfig. skinPath = FCKConfig. basePath + 'Skins/default/'; this line sets the skin. If silver is retained during streamlining, change the path to skins/silver. By default, it is no longer needed;
FCKConfig. DefaultLanguage = 'en'; set the default language and change en to zh-cn, Which is simplified Chinese;
FCKConfig. TabSpaces = 0; if you need to use the TAB key during editing, change 0 to 1;
Because FCKeditor is ASP by default, You need to replace it with ASP. NET. Delete ASP and other commented-out codes, and use ASP. NET instead. For example, FCKConfig. LinkBrowserURL = FCKConfig. BasePath + 'filemanager/browser/default/browser.html? Connector = connectors/asp/connector. asp ';
// FCKConfig. LinkBrowserURL = FCKConfig. BasePath + 'filemanager/browser/default/browser.html? Connector = connectors/asp/connector. asp & ServerPath =/CustomFiles /';
// ASP. NET // FCKConfig. LinkBrowserURL = FCKConfig. BasePath + 'filemanager/browser/default/browser.html? Connector = connectors/aspx/connector. aspx ';
// ColdFusion // FCKConfig. LinkBrowserURL = FCKConfig. BasePath + 'filemanager/browser/default/browser.html? Connector = connectors/cfm/connector. cfm ';
// Perl // FCKConfig. LinkBrowserURL = FCKConfig. BasePath + 'filemanager/browser/default/browser.html? Connector = connectors/perl/connector. cgi ';
// PHP // FCKConfig. LinkBrowserURL = FCKConfig. BasePath + 'filemanager/browser/default/browser.html? Connector = connectors/php/connector. php ';
// PHP-mcpuk // FCKConfig. LinkBrowserURL = FCKConfig. BasePath + 'filemanager/browser/mcpuk/browser.html? Connector = connectors/php/connector. php ';
Retain only:
FCKConfig. LinkBrowserURL = FCKConfig. BasePath + 'filemanager/browser/default/browser.html? Connector = connectors/aspx/connector. aspx ';
The rest of the Code follows the above steps to delete other WEB languages and only retain ASP. NET. You can also click here to download my simplified files. Note: This is only applicable to ASP. NET. Do not use other languages! We recommend that you decompress the file to another directory and copy it to the corresponding location of the WEB directory to avoid file loss.
Save the changes. FCKeditor fully supports ASP. NET. Of course, there are still some security issues, as long as you modify the corresponding toolbar, right-click the menu, and so on, because my background does not face the front-end users, that is, there is no message book or reply to the diary, so skip these steps. The next step is to open VS. NET and add FCKeditor to the ASP. NET page.
Iv. ASP. NET Applications
Open the "Resource Manager" of the project, remove the "FreeTextBox" reference from the reference, and add the "FredCK. FCKeditorV2" reference.
Open the file corresponding to the add article and manage the article to modify the content. The following uses "add an article" as an example. Switch to the "HTML" interface, delete the original FTB registration information, and add the FCK reference. The Code is as follows:
<% @ Register TagPrefix = "FCKeditorV2" Namespace = "FredCK. FCKeditorV2" Assembly = "FredCK. FCKeditorV2" %>
Make sure that the values of "AutoEventWireup" and "validateRequest" in @ Page are both false. Otherwise, when your post contains links or other HTML statements ,. NET will warn you of security risks and errors. Add the FCKeditor Control to the proper position of the form. Of course, the form must have "runat =" server "". The Code is as follows:
<FCKeditorV2: FCKeditor id = "content" runat = "server"> </FCKeditorV2: FCKeditor>
You can name the id by yourself. If the program detects whether the input is null, it is no longer content. Text, but content. Value.
So far, the file has been modified. All code is as follows:
<% @ Page language = "C #" Codebehind = "AdminFileAdd. aspx. cs" AutoEventWireup = "false" Inherits = "MyBlog. Admin. AdminFileAdd" validateRequest = false %>
<% @ Register TagPrefix = "FCKeditorV2" Namespace = "FredCK. FCKeditorV2" Assembly = "FredCK. FCKeditorV2" %>
<! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN">
<HTML>
<HEAD>
<Title> AdminFileAdd </title>
<Meta content = "Microsoft Visual Studio. NET 7.1" name = "GENERATOR">
<Meta content = "C #" name = "CODE_LANGUAGE">
<Meta content = "JavaScript" name = "vs_defaultClientScript">
<Meta content = "http://schemas.microsoft.com/intellisense/ie5" name = "vs_targetSchema">
<LINK href = "admin.css" type = "text/css" rel = "stylesheet">
</HEAD>
<Body class = "right">
<Form id = "Form1" method = "post" runat = "server">
<Div> add an article </div>
<Div class = "main">
<Ul>
<Li>
Title: <asp: textbox id = "title" runat = "server" MaxLength = "50" Width = "250px"> </asp: textbox>
<Li>
Topic: <asp: dropdownlist id = "m" runat = "server" AutoPostBack = "True"> </asp: dropdownlist>
<Li>
<FCKeditorV2: FCKeditor id = "content" runat = "server"> </FCKeditorV2: FCKeditor>
<Li>
<Asp: button id = "add" runat = "server" Text = "Submit"> </asp: button>
</Li>
</Ul>
</Div>
</Form>
</Body>
</HTML>
After modifying other files according to the preceding method, you can generate a new solution. Then, you can feel the shock of FCKeditor. Note that if you are using Windows XP SP2 and enable the "pop-up window Blocker", add your site to the "allowed site, otherwise, a script error is prompted when you insert an image or Flash file.