FCKeditor PHP configuration

Source: Internet
Author: User
PHP configuration of FCKeditor 1. download FCKeditor multi-language edition 2. decompress the package to lose weight: delete/FCKeditor/directory, except fckconfig. js, fckeditor. js, fckstyles. xml, fcktemplates. xml, fckeditor. php configuration for FCKeditor

1. download the FCKeditor multi-language edition

2. decompress the package to lose weight for the folder:

Delete all files except fckconfig. js, FCKeditor. js, fckstyles. xml, fcktemplates. xml, and fckeditor. php in the/fckeditor/directory.
Delete the directory/editor/_ source, _ testcases (basically, all folders or files starting with _ are optional ),
Delete all directories except the PHP directory in/editor/filemanager/browser/default/connectors/
Delete all directories except the PHP directory under/editor/filemanager/upload/
Delete all files except en. js, zh. js and zh-cn.js under/editor/lang/
3.
Open/FCKeditor/fckconfig. js
Modify
Var FCKConfig. DefaultLanguage = 'zh-cn ';
Var _ FileBrowserLanguage? = 'Php ';
Var _ QuickUploadLanguage? = 'Php ';
To enable file upload, you also need to configure FCKeditor \ editor \ filemanager \ upload \ php \ config. php and \ FCKeditor \ editor \ filemanager \ browser \ default \ connectors \ php \ config. php
(Garbled characters will occur when uploading a Chinese name file)

4. call method
Put FCKeditor in the website root directory
The PHP file contains the/FCKeditor/fckeditor. php file.
// Contains the fckeditor class
Include ("../FCKeditor/fckeditor. php ");
// Set the editor path
$ SBasePath = "/FCKeditor/"; // The path must be the same as the preceding import path; otherwise, an error is returned: the fckeditor.html page cannot be found.
// Create a Fckeditor with the form name ipaddr
$ OFCKeditor = new FCKeditor ('ipadd'); // ipaddr is the name of the tag. you can use $ _ POST ['ipadd'] to obtain the content of the editor.
$ OFCKeditor-> BasePath? = $ SBasePath;
// Set the initial value of the form.
$ OFCKeditor-> Value? = 'This is someSample text';
$ OFCKeditor-> Create (); // Note: If a template (such as smarty) is used, $ fck = $ oFCKeditor-> CreateHtml (); then $ fck is thrown to the template.

// You can also set
$ OFCKeditor-> Width
$ OFCKeditor-> Height
$ OFCKeditor-> ToolbarSet

5. customization
A. Custom call path
Change the FCKeditor directory to editor/, and specify the root path as/editor/during the call /.
B. customized style
You can customize the style by modifying the Skin under the editor \ skins directory, mainly by modifying CSS.
C. Custom toolbar

In fckconfig. js, Default and Basic toolbar are customized by Default. you can also customize your own toolbar according to the format, and use $ oFCKeditor-> ToolbarSet = toolbarname in php to call

D. Custom fonts
Add the following to the fckconfig. FontNames font list in FCKConfig. js:
; _ GB2312;
(Save it as UTF8 format)

E. Disable file upload.
I. set fckconfig. LinkBrowser, FCKConfig. ImageBrowser, FCKConfig. FlashBrowser, FCKConfig. LinkUpload, FCKConfig. ImageUpload, and FCKConfig. FlashUpload in FCKConfig. js to false.
Ii. directly delete the php file in filemanager
Iii. Custom toolbars
Most importantly, you need to change the php file under filemanager. only authenticated users can access the file.

F. note: use an editor such as Editplus to edit the configuration file. Note that the format is utf8.

?

?

?

?

?

?

?

?


//////////////////////////////////////// /////////////////

?

Someone may ask: how can I get an HTTP Error 404-Not Found. Error? This error is generally caused by incorrect BasePath settings. refer to the BasePath precautions mentioned above and check carefully!

At this point, the configuration of FCKeditor is not actually completed, because it contains a powerful feature we have not configured correctly: file upload.

In Default. in aspx running mode, click the "Insert/edit Image" (or Flash) function of FCKeditor. in the pop-up box, click "browse server" and a dialog box appears, the following error message is displayed: XML request error: Forbidden (403 ).

If you get such errors, Web development experience knows that 403 should be a read/write Permission problem. But why? The reason is that the UserFiles path is not configured.

Create an empty directory named Files in the root directory of FCKPro. The common practice of setting BasePath together with BasePath is as follows:

Open the Web. Config file of the FCKPro project and modify the appSettings element. the configuration is as follows:


?

?


After FCKeditor: BasePath is set, you no longer need to specify the BasePath attribute every time you use the FCKeditor instance. FCKeditor: UserFilesPath is the directory where all uploaded files are located. You may ask why you want to set it to/FCKPro/Files instead ~ /Files, because FCKeditor uses this value to return the relative path of the uploaded file to the client ,~ /Files can be compiled and interpreted by ASP. NET in the service, but the static Files on the client do not understand what this is. If you use ~ /Files, the returned paths of all uploaded Files are ~ /Files, you will get the link http ://~ /Files/Image/logo.gif. So we need to set it like the above. this is in the development phase. if the project is released after completion, remember to change/FCKPro/Files to/Files. The principle is not clear to everyone, during the development phase, VS2005 uses http: // localhost/project name/as the URL for running the project. after the project is published, a site is created on the Server. the URL is in the form of http://www.abc.com/and must be changed later. These are common errors that occur when FCKeditor2.2 + ASP. NET2.0 is used, and the cloud is unknown.

Don't be happy first. this Upload function is still the most crucial step. Find fckconfig in the root directory of FCKeditor (FCKPro/FCKeditor. open the js file in a text editor. find it in about 132 lines (probably because you may have changed the file by referring to other materials:

?

Var _ FileBrowserLanguage ??? = 'Asp ';????? // Asp | aspx | cfm | lasso | perl | php | py

Var _ QuickUploadLanguage = 'asp ';????? // Asp | aspx | cfm | lasso | php

?

Change the value of the values of the two row assignment codes from asp to aspx and save and close the file.

Okay, you're done! Run the FCKPro project here and use the browser server function. OK?

?

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.