Use and configuration of FCKeditor 2.6.6 under PHP (full version)
First, download
1, first to the official website to download FCKeditor2.6.6 multi-language version (can search "FCKeditor 2.6.6, released on the February 2010"). Download Address: Http://ckeditor.com/download.
Second, streamline
Follow the steps below to remove some of these unwanted test files:
1. Keep only fckconfig.js (config file), fckeditor.js (JS mode call file), fckeditor.php (php/fckeditor/), Fckeditor_ php4.php (php4 call file), fckeditor_php5.php (php5 call file), Fckstyles.xml (style), Fcktemplates.xml (template) File and Editor folder for all files except seven files;
2. Delete the directory/editor/_source (basically, all the folders or files beginning with _ are optional);
3. Delete all directories in the PHP directory except for the/editor/filemanager/connectors/(Web dynamic language supported by the editor);
4. Delete all files except En.js, Zh.js, zh-cn.js three files under/editor/lang/(Multi-language configuration file).
Third, set
1. Change the default language and programming language:
Open the/fckeditor/fckconfig.js; (Note that this file is utf-8 encoded, I saved it as an ANSI format when I first edited the result error, I found a long time reason) modified
Fckconfig.autodetectlanguage =false; (makes it impossible to automatically load the appropriate language based on the system language.) )
var fckconfig.defaultlanguage = ' ZH-CN ';
var _filebrowserlanguage = ' php ';
var _quickuploadlanguage = ' php ';
2. To open the File upload function:
Configure editor\filemanager\connectors\php\config.php
$config[' enabled '] = false; change to $config[' enabled ') = true;
Change $config[' userfilespath ' = '/userfiles/'; for your upload directory (note: This directory should exist-create it yourself);
Note: This directory is relative to the home directory. In other words, this directory is relative to the root directory, note that if you test on this machine, then this root directory is http://localhost.
Iv. Call
The FCKeditor editor can be called in the following example in PHP (the php file in the example is placed in a subdirectory of the Web site):
Include (".. /fckeditor/fckeditor.php ");??????? Contains the FCKeditor class, the FCKeditor directory is placed under the Web site root directory
$BasePath = "/fckeditor/";??????????? Editor Path
$oFCKeditor = new FCKeditor (' Cremer ');??? Create a FCKeditor object with the form name Cremer
$oFCKeditor->basepath? = $BasePath;
$oFCKeditor->value? = ' test ';??????? Set the form initial value
You can also set the following sections (the "=" include section), not necessarily:
//==================================================================================//
$oFCKeditor->width = ' 800′;??????????? Editor width, the class has a default value, if you do not want to modify it, regardless of the
$oFCKeditor->height= ' 300′s;??????????? Same width, here is high $ofckeditor->toolbarset
$oFCKeditor->toolbarset = ' Basic ';??????? The default Editor toolbar has both basic (basic tools) and default (all tools) options, and you can also create your own toolbars
$oFCKeditor->config[' skinpath '] = '/fckeditor/editor/skins/silver/';??????? Setting editor Skins
//==================================================================================//
$oFCKeditor->create ();??????????? Calling a method in a class, you must
Use $_post[' Cremer '] to get the value inside the text box.
Description
Contains the FCKeditor class
Include (".. /fckeditor/fckeditor.php ");
Set Editor Path
$sBasePath = "fckeditor/";
Create a FCKeditor, the Txtarea name of the form is called content
$oFCKeditor = new FCKeditor (' content ');
$oFCKeditor->basepath = $sBasePath;
Set the form initial value
$oFCKeditor->value = ' This is some sample text';
$oFCKeditor->create ();
Set the length width
$oFCKeditor->width
$oFCKeditor->height
$oFCKeditor->toolbarset
V. Other examples
?
Vi. Other Skills
1. Modify the toolbar button:
This is done primarily to improve security and reduce the functionality that the general user can use:
fckconfig.toolbarsets["MyStyle"] = [
[' Source ', ' Preview ', ' Fitwindow ', '-', ' Templates '],
[' Undo ', ' Redo ', '-', ' Find ', ' Replace ', '-', ' selectall ', ' Removeformat '],
[' Image ', ' Flash ', ' Table ', ' Rule ', ' Smiley ', ' Specialchar ', ' pagebreak '],
[' Showblocks '],
‘/’,
[' Bold ', ' Italic ', ' underline ', ' strikethrough ', ' 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 called:
$oFCKeditor->toolbarset?= ' MyStyle ';
2. How to display garbled characters when uploading Chinese name files
Find in File connectors/php/commands.php:
$sFileName = $oFile [' name '];
Add a line later:
$sFileName = Iconv ("Utf-8″," GBK ", $sFileName);
3, fixed the file list when the Chinese file name display garbled problem
Find in File connectors/php/util.php:
Return (Utf8_encode (Htmlspecialchars ($value)));
Modified to:
Return Iconv (", ' Utf-8′,htmlspecialchars ($value)");
4, fixed the folder name garbled problem when new Chinese folder
?
Find in File connectors/php/commands.php:
$sNewFolderName =
Add a line later:
$sNewFolderName = Iconv ("Utf-8″," GBK ", $sNewFolderName);
The HTML file under version 2.6.3 and subsequent versions of FCK has been added with the Utf-8 file header.
5. Add different styles to the article
6, configure the skin.
The "fckeditor\editor\skins\" catalogue has default, office2003, and silver styles to choose from.
Open/fckeditor/fckconfig.js;
Fckconfig.skinpath = Fckconfig.basepath + ' skins/default/';
7. You can use the TAB key within the editor domain.
Open/fckeditor/fckconfig.js; modify (1 to Yes, 0 to No)
fckconfig.tabspaces = 0; Change to fckconfig.tabspaces = 1;
8, plus a few commonly used fonts:
Open/fckeditor/fckconfig.js;
? Fckconfig.fontnames = ' song body; blackbody; script; italics _gb2312; Arial; Comic Sans MS; Courier New; Tahoma; Times New Roman; Verdana ';
9. Modify the default display font
You can modify the style sheet to meet the requirements, open the/EDITOR/CSS/FCK_EDITORAREA.CSS, modify the Font-size property.
10, in the Upload File window click Browse Server Error
There may be "the server didn ' t send back a proper XML ..." The error prompt.
Because FCKeditor requires different types of files to be uploaded to different directories, including directories such as File,image,falsh,media, you can first set up to try.