FCKeditor PHP is equipped with

Source: Internet
Author: User
PHP Configuration for FCKeditor

1, download FCKeditor multi-Country language version

2, after decompression for the folder weight loss:

Delete all files except Fckconfig.js, Fckeditor.js, Fckstyles.xml, fcktemplates.xml,fckeditor.php Five files under the/fckeditor/directory
Delete Directory/editor/_source,_testcases (basically, all folders or files beginning with _ are optional),
Delete all directories under/editor/filemanager/browser/default/connectors/except for the PHP directory
Delete all directories except PHP directory under/editor/filemanager/upload/
Delete all files under/editor/lang/except En.js, Zh.js, zh-cn.js three files
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
(Uploading Chinese name file will be garbled)

4. Calling methods
Place FCKeditor in the Web site root directory
Inside the php file, contains the/fckeditor/fckeditor.php file
Contains the FCKeditor class
Include (".. /fckeditor/fckeditor.php ");
Set Editor Path
$sBasePath = "/fckeditor/";; /This path must be consistent with the introduction of the above path, otherwise it will error: fckeditor.html page not found
Create a FCKeditor, the name of the form is ipaddr
$oFCKeditor = new FCKeditor (' ipaddr '),//ipaddr is the name of this tag and can get the contents of the editor with $_post[' ipaddr ')
$oFCKeditor->basepath? = $sBasePath;
Set the form initial value
$oFCKeditor->value? = ' This is some sample text';
$oFCKeditor->create ();//NOTE: If you use a template (such as smarty) $FCK = $oFCKeditor->createhtml (), and then toss the $FCK to the template

You can also set
$oFCKeditor->width
$oFCKeditor->height
$oFCKeditor->toolbarset

5. Customization
A. Customizing the call path
Change the FCKeditor directory directly to editor/, and specify the root path to/editor/when called.
B. Custom style
You can customize the style by modifying the skins in the Editor\skins directory, mainly by modifying the CSS.
C. custom Toolbar

In Fckconfig.js, the default custom Default,basic two kinds of toolbar, you can also customize your own toolbar according to the format, and use $ofckeditor->toolbarset= in PHP Toolbarname Call

D. Custom Fonts
Add the Fckconfig.fontnames font list in the Fckconfig.js to the front:
Arial, Bold, _gb2312, italic;
(Note Save As UTF8 format)

E. Closing file uploads
I. Will fckconfig.js inside the Fckconfig.linkbrowser,fckconfig.imagebrowser, Fckconfig.flashbrowser,fckconfig.linkupload, The fckconfig.imageupload,fckconfig.flashupload is set to false.
II. Delete the PHP files in the FileManager directly
III. Custom toolbars
Most importantly, you need to change the PHP file under FileManager to be accessible only to authenticated users.

F. Note: Please use an editor such as EditPlus to edit the configuration file, note that the save format is UTF8.

?

?

?

?

?

?

?

?


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

?

Someone will ask: how to get an HTTP error 404-not Found. To get this error is generally basepath not set correctly, see the above mentioned BasePath precautions carefully check!

Here, FCKeditor's configuration is not really complete, because it's a powerful feature we haven't configured properly: File upload.

In the run mode of Default.aspx, click FCKeditor "Insert/Edit image" (or flash) function, in the pop-up box "Browse Server", and then a dialog box pops up, then an error box is displayed XML request error: Forbidden (403).

To get such a mistake with web development experience all know that 403 should be a question of read and write permissions. But why? The reason is that the userfiles path is not configured.

We create a new empty directory under the Fckpro root directory, files. Together with the setup of BasePath, the usual practice is this:

Open the web for the Fckpro project. Config file, modify the appsettings element, configured as follows:


?

?


When Fckeditor:basepath is set, it is not necessary to specify the BasePath attribute every time the FCKeditor instance is used, Fckeditor:userfilespath is the directory where all of our uploaded files are located. You might ask why you should set it to/fckpro/files so instead of ~/files, because FCKeditor uses this value to return the relative path of your uploaded file to the client, ~/ Files is in the form of ASP. The service can be compiled and interpreted, but at the client's static does not understand what this is. If you use ~/files, then all the uploaded file return path is ~/files form, you will get such a link http://~/Files/Image/logo.gif such a link Chengo is the path to find. So we have to set up the above, this is in the development phase, if the project after the completion of the release, please remember to change the/fckpro/files to/files, the reason does not say that we also understand that the development phase VS2005 when the project is running the URL is http://localhost/project name /In the form, after publishing on the server to establish a site, with the path is the form of http://www.abc.com/, so after the release must be changed. These are places where you often send errors and inexplicable clouds when using fckeditor2.2+asp.net2.0.

Don't be happy, this upload feature is still the most critical step. Locate the Fckconfig.js file in the root directory of FCKeditor (fckpro/fckeditor/), open it with a text editor, and find it in about 132 lines (presumably because you might have changed the file before):

?

var _filebrowserlanguage??? = ' ASP ';????? ASP | aspx | CFM | Lasso | Perl | php | Py

var _quickuploadlanguage = ' asp ';????? ASP | aspx | CFM | Lasso | Php

?

Change the value of these two lines of assignment code from ASP to ASPX and save to close the file.

All right, it's done! Run the Fckpro project here, use the Browse 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.