PHP under the FCKeditor2.6.5 Web page Editor Usage _ Page Editor

Source: Internet
Author: User
Tags data structures php and
1, first to the official website download FCKeditor2.6.5 multi-language version. Http://ckeditor.com/download, note: The first is the latest 3.0.1 version, the second is FCKeditor 2.6.5

2, delete unnecessary things:

Delete the/fckeditor/directory except the fckconfig.js,fckeditor.js,fckstyles.xml,fcktemplates.xml,fckeditor.php,fckeditor_php5.php, fckeditor_php4.php
All documents other than seven documents;
Deletes the directory/editor/_source (basically, all folders or files beginning with _ are optional);
Delete all directories except the PHP directory under/editor/filemanager/connectors/;
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 open file upload, you also need to configure editor\filemanager\connectors\php\config.php
Change $config[' enabled '] = False to $config[' enabled ' = true;
Change $config[' userfilespath ' = '/userfiles/'; for your upload directory;

4. Call Method (example)
Place the FCKeditor in the site root directory
Inside the PHP file, include the/fckeditor/fckeditor.php file
Copy Code code as follows:

Include FCKeditor class
Include (".. /fckeditor/fckeditor.php ");
Set Editor Path
$sBasePath = "/fckeditor/";
Create a FCKeditor, the Txtarea name of the form is called the content
$oFCKeditor = new FCKeditor (' content ');
$oFCKeditor->basepath = $sBasePath;
Set the form's initial value
$oFCKeditor->value = ' This is some <strong>sample text</strong> ';
$oFCKeditor->create ();

You can also set
$oFCKeditor->width
$oFCKeditor->height
$oFCKeditor->toolbarset
......................................................................................................................... .............................
<textarea name= "Content" style= "Display:none" > This is the contents of the article test! </textarea>
<?php
Include_once ("fckeditor/fckeditor.php");

$oFCKeditor =new fckeditor (' content ');
$oFCKeditor->basepath= ' fckeditor/';
$oFCKeditor->value= ' default text in editor ';
$oFCKeditor->width= ' 800px ';
$oFCKeditor->height= ' 300px ';
$oFCKeditor->create ();
$FCK = $oFCKeditor->createhtml ();
?>


For FCKeditor upload Chinese name file, display garbled problem, the method is published as follows:
Test environment: PHP 5, UTF-8 encoding

1. Correct file name garbled problem when uploading Chinese files
Find in File connectors/php/commands.php:
$sFileName = $oFile [' name '];
Add a line later:
$sFileName = Iconv ("Utf-8", "GBK", $sFileName);

2, the Correction file list when 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));

3, fixed the new Chinese folder when the folder name garbled problem
Find in File connectors/php/commands.php:
$sNewFolderName =
Add a line later:
$sNewFolderName = Iconv ("Utf-8", "GBK", $sNewFolderName);

2.6.3 and subsequent versions of the FCK HTML files have been added to the Utf-8 file header.

here are some additional
Maybe you often go backstage in the website, or publish articles or something, you can give your article to add different styles, different fonts, what, maybe you will think how to do it, in fact, this is very simple, just need to use the next FCKeditor this small plug-in can be realized, below we see examples!
Download the latest source code on FCKeditor's official website, http://ckeditor.com/download downloads the latest FCKeditor source package.
Download will be configured, the source package has fckeditor/_samples this file, which has written examples, you can directly run, so, you can refer to such source files, to rewrite, need to pay attention to, where most of the editor can use, upload pictures but can not use,
The following configuration upload image features.

Open File fckeditor/editor/filemanager/browser/default/connectors/php/config.php:
Look for $config[' Enabled ', set it to ' true ', find $config[' Userfilespath ', and set it to a catalog of pictures, which 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,

So the basic configuration has been written, and here's a little example I wrote, index.php

<form name= "Form1" method= "Post" action= "index.php" target= "_blank" >
<?php
Reference fckeditor.php This file, the basic classes and data structures are all here
Include ("fckeditor/fckeditor.php");

?>
<input id= "Content" name= "content" value= "type=" hidden "/>" <iframe id= "content___frame" frameborder= "0" height= "100%" scrolling= "no" width= "100%" src= "/test/bianyiqi/fckeditor/editor/fckeditor.html"? Instancename=content&toolbar=default "> </iframe>
<input name = "Haiyang" value= "The first time tomorrow I will be better" type= "text"/>
<input type= "Submit" name= "Submission" value= "submitted"/>
</Form>

<?php
echo stripslashes ($_post[' content ');
echo "<br/>";
echo $_post[' Haiyang '];
?>
Direct test can be, note that index.php and FCKeditor are under the same level of directory

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.