Many friends now like to use the fckeditor editor under Asp. Here are the specific usage methods. Friends who need it can refer to it. Let me first talk about my test environment: XPSP2, IIS5.1, FCKeditor2.0
Create a new site on IIS, I named it FCKeditor directly
Establish a corresponding site in DW, the test server is native, and supports VBScript
Download FCKeditor 2.0. This thing is open source and there are many places you can download online. Find it yourself...
What you download should be a compressed package, decompressed to the root directory of the FCKeditor site, and you can start calling directly. When you know, you will find that it is so simple that you will die!
In the site root directory, create a new index.asp page and add the following code to the segment (call the editor):
The code copy is as follows:
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = /FCKeditor/ //Set 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 //In the future, the content in the editor will be obtained by this logbody, and the naming will be determined by you.
%>
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = /FCKeditor/ //Set 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 //In the future, the content in the editor will be obtained by this logbody, and the naming will be determined by you.
%>
If you add this paragraph, don't forget to add it in the second line before index.asp
The code copy is as follows:
<!--#include file=FCKeditor/fckeditor.asp -->
Include fckeditor.asp. Remember to remember!
It's that simple!
Now you just use this editor as a control and use: request(logbody) when extracting its data
Now breathe a sigh of relief. The test was successful. There are some settings inside, please go to the Internet to find some advanced instructions for use.
Preliminary use of FCKeditor
FCKeditor 2.0 version has finally come out. The reason why I use the word "Finish" is because the Flash insertion function that everyone hopes to be added to this version. It can be said that among all online editors, FCKeditor is currently the best editor on the Internet. It has powerful functions and supports multiple browsers. It has no platform restrictions. It can be integrated with multiple WEB languages, multi-language support, open source, etc.
For a brand new website, FCKeditor can be used directly, without any modifications. However, for most existing websites, some settings of FCKeditor are not suitable for your own use. This article aims to tell you to simply modify FCKeditor to facilitate the use of your website.
The first job is to streamline this large-scale editor, of course, it is to streamline files rather than functions. Here I take the asp version of FCKeditor as an example, enter the FCKeditor 2.0 folder, and first delete all the folders starting with _. These folders contain examples or some other tools. In fact, it is just to keep editor folders, fckconfig.js, fckeditor.asp, fckeditor.js, fckstyles.xml, and fcktemplates.xml. After the outermost layer is simplified, enter the editor folder and first put it in the _ Source folder delete, here are some source files, which are of no use for use.
Enter the images folder and delete the smiley folder. Some files are placed with emoticons. Since I will use my own emoticons to delete them first. Of course, if you want to use the emoticons here, don't delete them. Falled. Exit images and enter the lang folder. You can clean up the things here. Only the four files, fcklanguagemanager.js, zh-cn.js, en.js, and zh.js. The first file is language configuration The file, with it, can it be set in fckconfig.js to the corresponding language file corresponding to the settings in fckconfig.js. zh-cn.js is a simplified Chinese language package, and there is no need to mention en.js, zh.js is traditional Chinese. How about it? I lost a few hundred K at once, so it's great~
Exit the lang folder and enter the skin folder. If you want to use the default color of fckeditor, then delete the other two folders except the default folder directly. If you want to use something else, then consider it yourself. But I would like to give you a suggestion. If you don’t want to use the default one, then choose the silver, because silver, that is, gray, will not look ugly when matched with any color, and I don’t like the skin of office2003 anyway. And the picture is relatively large, and the download time is increased, don’t!
The last step to simplify it is to exit the skin folder and then enter filemanager. If you are not using the latest version of fckeditor, then there is a folder browser here, and the new version also has an upload folder. Come one by one, first enter filemanager/browser/default/connectors/. Because I use asp, I delete all except the asp folder. Then go to filemanager/upload/, and then leave only the asp folder. At this point, the editor simplification has ended. Next, we will make settings and modifications to the editor.
The first modified file, which is the fckeditor total configuration file, is located in the fckconfig.js file in the root directory. Please follow the list below (whichever is the case with fckeditor version 2.0):
Find line 20 FCKConfig.DefaultLanguage = 'en' ; Change to FCKConfig.DefaultLanguage = 'zh-cn' ; Set the default language to Simplified Chinese
Find line 40 FCKConfig.TabSpaces = 0; Change to FCKConfig.TabSpaces = 1; that is, you can use the Tab key in the editor domain.
If your editor is still used in the front desk of the website, such as when using a message book or a diary reply, you have to consider security. Don’t use Default toolbar in the front desk, either customize the function or Use Basic, which is the basic toolbar,
Found line 64 FCKConfig.ToolbarSets[Basic] = [
['Bold','Italic','-','OrderedList','UnorderedList','-',/*'Link', */'Unlink','-','Style','FontSize',' TextColor','BGColor','-','Smiley','SpecialChar','Replace','Preview']
] ;
This is the Basic I have changed. Remove the image function and the link function, because the image and link, the Flash and image button addition functions can allow the front desk page to directly access and upload files. If you don't change here, just upload a Trojan horse to you. Not finishing the game soon? But this is not enough. Fckeditor also supports the right mouse button function in the edit domain.
Found line 73
FCKConfig.ContextMenu = ['Generic',/*'Link',*/'Anchor',/*'Image',*/'Flash','Select','Textarea','Checkbox','Radio',' TextField','HiddenField',/*'ImageButton',*/'Button','BulletedList','NumberedList','TableCell','Table','Form'] ;
This is also what I have changed to remove the right mouse button link, image, Flash, and image button functions.
Found line 77 FCKConfig.FontNames = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana';
Add several fonts that we commonly use FCKConfig.FontNames = 'Song font; bold font; official script; Kai font_GB2312; Arial; Comic Sans MS; Courier New; Tahoma; Times New Roman; Verdana'; ;
Next, we will set up the upload function. Take ASP as an example. In fact, the default fck is asp. Just delete all commented codes below 100 lines, and then add all the browser.html and upload below. Change the ?Type=XX after .asp to Type=YY, where YY is the name of the folder you want to save the file.
If you still want to use your emoticon icon, then jump to line 131 and change the folder address of the emoticon icon and the file name of the emoticon icon below. The following three numbers are the number of emoticons displayed in each line and The width and height of the pop-up window are as wide and high as the size of this window depends on the size of the window arranged by your emoticon icons. OK, the total configuration file modification has ended.
Next is the setting of the editor location. My habit is to place the editor in the root directory. The five files mentioned at the beginning are also placed in the root directory (Tips: It is recommended to place them in the root directory, and it is recommended to set them when using them. The path also uses an absolute path, such as /fckeditor/, and my habit is set to /), which is conducive to the update and upgrade of fckeditor, and all folders under the website can be called arbitrarily, and no other folder names have changed and other There is no problem with the editor being used.
Open the fckeditor.asp file and find sBasePath = /fckeditor/change to sBasePath = /
Open the fckeditor.js file and find this.BasePath = '/fckeditor/' ; Change to this.BasePath = '/' ;
The default display font in the editor domain is 12px, while the default font on my home page is 14px, so it feels very uncomfortable to look at it. If you want to modify it, you can achieve the requirements by modifying the style sheet. Open /editor/css/fck_editorarea.css and turn it into Change the 4th line to font-size: 14px;
Next is the setup for uploading files. This is more troublesome, please operate carefully.
Open /editor/filemanager/browser/default/frmresourcetype.html, find line 15, insert ['uploadfile','uploadfile'], and cooperate with the settings in fckconfig.js just now, then my upload file path is /uploadfile Of course you can also change it to the folder you want, but the name here must be consistent with the YY in Type=YY in fckconfig.js.
Not finished yet, continue to enter editor/filemanager/browser/default/connectors/asp, open config.asp, first change ConfigIsEnabled = False to ConfigIsEnabled = True. If the file is not impossible to upload, then change ConfigUserFilesPath = /UserFile to I want ConfigUserFilesPath = /.
Then add ConfigAllowedExtensions.Add uploadfile after Set ConfigDeniedExtensions = CreateObject( Scripting.Dictionary ),
ConfigDeniedExtensions.Add uploadfile,
Similarly, the settings here must correspond to the above and in fckconfig.js.
There is another upload, which is a quick upload. This function is only available in fckeditor 2.0. Previous versions did not have this function. Enter /editor/filemanager/upload/asp, open config.asp, and set ConfigIsEnabled = False to ConfigIsEnabled = True. I changed ConfigUserFilesPath = /UserFiles/ to the ConfigUserFilesPath = /uploadfile/& Year (Date()) &-& Month(Date()) &/, because my upload file is placed in the uploadfile folder and is open to the public by month. Quick upload will not allow you to select a folder, but will be uploaded directly through the settings here. If the settings here are not well matched with the previous settings, your files will be uploaded in a mess and inconvenient to manage. Repeat the operation in the previous config.asp before connecting, and add it to the following
ConfigAllowedExtensions.Add uploadfile,
ConfigDeniedExtensions.Add uploadfile,
Next, let’s talk about how to create your own online editor. Here we take ASP and JS versions as examples, ASP version sample code, which is generally used for background operations:
The code copy is as follows:
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = /
oFCKeditor.ToolbarSet = Default
oFCKeditor.Width = 100%
oFCKeditor.Height = 400
oFCKeditor.Value = rs(logbody)
oFCKeditor.Create logbody
%>
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = /
oFCKeditor.ToolbarSet = Default
oFCKeditor.Width = 100%
oFCKeditor.Height = 400
oFCKeditor.Value = rs(logbody)
oFCKeditor.Create logbody
%>
Of course, the ASP version can only be used in pages with .asp as the extension. If you set BasePath to / in fckedito.asp before, you can save the third line here. There is only one Create in the ASP version. function. It is recommended to use the ASP version when modifying a content.
Next, let’s look at the JS version:
The code copy is as follows:
<script type=text/javascript>
var oFCKeditor = new FCKeditor( 'logbody' ) ;
oFCKeditor.BasePath = '/' ;
oFCKeditor.ToolbarSet = 'Basic';
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '400' ;
oFCKeditor.Value = '' ;
oFCKeditor.Create();
</script>
BasePath settings are as mentioned above. The JS version can be used in any web page, or even for html pages, because it is generated by the client. The advantage is that it can reduce network traffic because the editor file only needs to be downloaded once. Second, the client can define when to display it. Since fckeditor initialization takes a certain amount of time, JS is very useful at this point.
In addition, there is another function function in the JS version, which is the ReplaceTextarea() function, which can replace the specified TextArea and take the reply part of my website's log:
The code copy is as follows:
<script type=text/javascript>
<!--
function showFCK(){
var oFCKeditor = new FCKeditor( 'fbContent' ) ;
oFCKeditor.BasePath = '/' ;
oFCKeditor.ToolbarSet = 'Basic';
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '200' ;
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, and the fckeditor is generated when the user displays the editor opens. Without initializing an editor every time the page is refreshed, the page will be much faster.
Supplement: As mentioned earlier, it is said that you should not use JS version when editing existing data content. This is caused by the problem of single quotes ('). In the data content, there will inevitably be single quotes and use JS version to generate and edit. When using the ASP version, the data is treated as a variable and then it is directly assigned to the editor. Also, unless you want to use the ReplaceTextArea() method to generate the editor, you don't need to write a tag like <textarea> first. Everything will be automatically generated by fckeditor. All you need to do is specify an instance name for fckeditor. . At the same time, you don’t have to worry about how to submit. When the form is submitted, fckeditor will automatically submit, and the submitted variable name is named after the fckeditor instance you specified.