FCKeditor application note-start

Source: Internet
Author: User

Recently, due to the need of work, we suddenly wanted to create something similar to a news system that required the ability to publish information, so it involved online editing. There are many existing online editing controls, such as Ftb, RichTextBox, fck, and cuteeditor. After repeated consideration, I finally chose fck, because it is open-source and has good functionality and compatibility.

However, it still went through some twists and turns. Now we have recorded some of the processes and problems we encountered.

The first step is to download a copy at http://sourceforge.net /.CodeCome back, or directly press http://www.fckeditor.net. The latest version is 2.0. Note that FCKeditor 2.0 and FCKeditor are on the top. packager, FCKeditor. net, FCKeditor. java, FCKeditor. we use several files such as plone. net, you must download FCKeditor. net, you will know the name, but there are more than that. You must download FCKeditor 2.0 at the same time, here FCKeditor. net is actually a control, and the client code used must be in FCKeditor 2.0. I made such a mistake when I used it for the first time, and there was nothing after the result was run. It was a prompt!

The next step is to put FCKeditor in your project. The downloaded file contains several folders and FCKeditor files with various suffixes, all the files starting with the following line can be deleted to save space. In addition, other files irrelevant to our application can be deleted. The following figure shows the remaining files.

These folders can be directly used in the root directory of the project directory. In this way, you only need to set the basepath attribute of the FCKeditor Control to the name of the directory where the project is located, but there are files in addition to folders, after all, it will bring chaos to our file management, so I suggest putting them all in a directory (the folder name is set by myself, here I use the Editor folder ).

Now, let's first try whether the control is feasible.

Create a new web project in vs.net, add a FCKeditor Control in the toolbar, drag it to our test page, and make some simple settings.

The value is the edited content displayed in the fck editing. The toolbarset attribute is set to default temporarily. In the following content, I will explain how to set the toolbar by myself. The basepath is empty here, however, if you put the file in the root directory as mentioned above, you only need to display the project directory here, but this may cause some trouble for deployment, therefore, we recommend that you set its value in the pageload event. The value can be obtained based on the directory of the current project.

1 String Streditorbase = "" ;
2 String Strpathinfo = Request. servervariables [ " Path_info " ];
3 Strpathinfo = Strpathinfo. substring ( 0 , Strpathinfo. lastindexof ( " / " ) +   1 );
4 Streditorbase = Strpathinfo +   " Editor/ " ;
5

The value of the variable streditorbase is the directory where the FCKeditor file is located. Of course, it is best to write this code into an independent class because this directory will be used in multiple places, for example, it is used when setting the control skin.

Run it and try to see if the effect has come out. Next I will discuss how to configure the editor.

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.