Use and configuration of fckeditor2.6.6 on PHP (Full Version)-php Tutorial

Source: Internet
Author: User
Use and configuration of fckeditor2.6.6 in PHP (full version) I. download 1. first download FCKeditor2.6.6 from the official website (you can search "FCKeditor2.6.6, releasedon15February2010 "). : Ckeditor. comdownload. II. streamline the usage and configuration of fckeditor 2.6.6 in PHP by following the steps below (full version)

1. Download

1. First, go to the official website to download the FCKeditor2.6.6 multi-language edition (you can search "FCKeditor 2.6.6, released on 15 February 2010 "). : Http://ckeditor.com/download.

II. streamlining

Follow these steps to delete unnecessary test files:

1. only fckconfig in the/fckeditor/directory is retained. js (configuration file), fckeditor. js (js call file), fckeditor. php (php call file), fckeditor_php4.php (php4 call file), fckeditor_php5.php (php5 call file), and fckstyles. xml (style), fcktemplates. xml (Template) files and all files other than the seven files in the editor folder;

2. delete the directory/editor/_ source (basically, all folders or files starting with _ are optional );

3. delete all directories except the php directory in/editor/filemanager/connectors/(which stores the Web dynamic language supported by the editor;

4. delete all files except en. js, zh. js, and zh-cn.js under/editor/lang/(which stores multilingual configuration files.

III. settings

1. change the default language and programming language:

Open/fckeditor/fckconfig. js; (please note that this file is UTF-8 encoded. when I edited it for the first time, I saved the ANSI format and the result failed. I found the cause for a long time.) Modify->

FCKConfig. AutoDetectLanguage = false .)

Var FCKConfig. DefaultLanguage = 'zh-cn ';

Var _ FileBrowserLanguage = 'php ';

Var _ QuickUploadLanguage = 'php ';

2. enable the file upload function:

Configure editor \ filemanager \ connectors \ php \ config. php

Change $ Config ['enabled'] = false; to $ Config ['enabled'] = true;

Change $ Config ['userfilespath'] = '/userfiles/' to your Upload Directory (note: This directory must exist-you have created it yourself );

Note: This directory is relative to the main directory. That is to say, this directory is relative to the root directory. Note that if you test it on the local machine, the root directory is http: // localhost.

IV. Call

You can use the following example to call the fckeditor editor in php (the php file in the example is placed in the subdirectory of the website:

Include ("../fckeditor. php ");??????? // Contains the fckeditor class. put the fckeditor directory under the website root directory.

$ BasePath = "/fckeditor /";??????????? // Editor path

$ OFCKeditor = new FCKeditor ('cremer ');??? // Create a fckeditor object named CreMer

$ OFCKeditor-> BasePath? = $ BasePath;

$ OFCKeditor-> Value? = 'Test ';??????? // Set the initial value of the form.

// You can also set the following parts ("="), not required:

// ================================================ ========================================================== ===== //

$ OFCKeditor-> Width = '000000 ′;??????????? // Editor width, which has default values in the class. if you do not want to modify it, skip this option.

$ OFCKeditor-> Height = '000000 ′;??????????? // Same width, which is high $ oFCKeditor-> ToolbarSet

$ OFCKeditor-> ToolbarSet = 'basic ';??????? // The Default editor toolbar has two options: Basic (Basic tool) and Default (all tools). You can also create a toolbar by yourself.

$ OFCKeditor-> Config ['skiconpath'] = '/fckeditor/editor/skins/silver /';??????? // Set the editor skin

// ================================================ ========================================================== ===== //

$ OFCKeditor-> Create ();??????????? // Call methods in the class, required

You can use $ _ POST ['cremer '] to obtain the value in the text box.

Note:

// Contains the fckeditor class

Include ("../fckeditor. php ");

// Set the editor path

$ SBasePath = "fckeditor /";

// Create a Fckeditor with the txtarea name of the form as content

$ OFCKeditor = new FCKeditor ('content ');

$ OFCKeditor-> BasePath = $ sBasePath;

// Set the initial value of the form.

$ OFCKeditor-> Value = 'This is someSample text';

$ OFCKeditor-> Create ();

// Set the length and width

$ OFCKeditor-> Width

$ OFCKeditor-> Height

$ OFCKeditor-> ToolbarSet

V. Other examples

?

6. other skills

1. modify the toolbar button:

In this way, the functions that can be used by general users are reduced to improve security:

FCKConfig. ToolbarSets ["MyStyle"] = [

['Source', 'preview', 'fitwindow', '-', 'templates'],

['Undo ', 'redo', '-', 'Find ', 'replace', '-', 'selectall', 'removeformat'],

['Image', 'flash', 'table', 'rule', 'smilil', 'specialchar ', 'pagebreak'],

['Showbuckets'],

'/',

['Bold ', 'italic', 'underline', 'strikethangout', 'textcolor', 'bgcolor'],

['Orderedlist', 'unorderedlist', '-', 'outdent ', 'indent', 'blockquote ', 'creatediv'],

['Justifyleft', 'justifycenter', 'justifyright', 'justifyfull'],

['Link', 'unlink', 'Anchor '],

'/',

['Style', 'fontformat', 'fontname', 'fontsize']

??? // No comma for the last row.

];

Or change

FCKConfig. ToolbarSets ["Basic"] = [

? ['Bold ', 'italic', '-', 'orderedlist', 'unorderedlist', '-', 'link', 'unlink', 'Image ', '-', 'about']

];

After setting, add this statement when calling:

$ OFCKeditor-> ToolbarSet? = 'Mystyle ';

2. what should I do if garbled characters are displayed when I upload a Chinese name file?

Find the following in the connectors/php/commands. php file:

$ SFileName = $ oFile ['name'];

Add a line after:

$ SFileName = iconv ("UTF-8", "gbk", $ sFileName );

3. fixed the problem of garbled characters in Chinese file names during File list

Find the following in the connectors/php/util. php file:

Return (utf8_encode (htmlspecialchars ($ value )));

To:

Return iconv (", 'utf-8', htmlspecialchars ($ value ));

4. fixed the garbled folder name issue when creating a Chinese folder.

?

Find the following in the connectors/php/commands. php file:

$ SNewFolderName =

Add a line after:

$ SNewFolderName = iconv ("UTF-8", "gbk", $ sNewFolderName );

Html files in versions 2.6.3 and later fck have added UTF-8 file headers.

5. add different styles to the article

6. configure the skin.

The "fckeditor \ editor \ skins \" directory contains default, office2003, silver, and other styles to choose from.

Open/fckeditor/fckconfig. js; modify->

FCKConfig. SkinPath = FCKConfig. BasePath + 'Skins/default /';

7. You can use the Tab key in the editor.

Open/fckeditor/fckconfig. js; modify (1 to yes, 0 to no)->

Change FCKConfig. TabSpaces = 0; to FCKConfig. TabSpaces = 1;

8. add several common fonts:

Open/fckeditor/fckconfig. js; modify->

? FCKConfig. FontNames = '; _ GB2312; Arial; Comic Sans MS; Courier New; Tahoma; Times New Roman; Verdana ';

9. modify the default font

You can modify the style sheet to meet the requirements. open/editor/css/fck_editorarea.css and modify the font-size attribute.

10. An error occurred while browsing the server in the upload File window.

"The server didn't send back a proper xml...?" may occur .....??" Error message.

Because FCKeditor requires different types of files to be uploaded to different directories, including directories such as file, image, falsh, and media, you can create them first.

Related Article

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.