How to import FCKeditor into PHP + SMARTY

Source: Internet
Author: User
Tags php tutorial


When extracting Fckeditor, use the following
PHP uses $ _ POST ['p _ info'] to obtain the value of FCKeditor.
Supplement:
1. The basepath path must be the same as the include path above. Otherwise, the file cannot be found)
In addition, if you want to save the input variable to the database, its variable name is
Object Name. For example, the above is "p_info"

2. There is an example of php Tutorial calling in FCKeditor/_ samples/, for example, simples01.php.
And sampleposteddata. php. The file that follows is the php that outputs the variable name.
Program to get the variable name in the text input box.

3. You can easily customize the toolbar function button of FCKeditor.
In the FCKeditor configuration file FCKeditor/fck_config.js.
A function button corresponds to a unique name.
In fck_config.js, three toolbar styles have been set by Default: Default (package
Including all functions), Accessibility and Basic.

Let's take a look at the custom format of the toolbar style:
Config. ToolbarSets ["ToolBarSetName"] = [// Toolbar name
['Item 1', 'item 2', '-', 'item 3', 'item n'], // first line of Toolbar
['Item 4', '-', 'item 5', 'item 6', 'item n'] // The second line of the Toolbar
];
Here '-' is used to create a split bar.

Instance

<?
$ BasePath = "../include/FCKeditor /";
Include ($ BasePath. "fckeditor. php ");

$ Fck = new FCKeditor ('P _ info'); // create an object
$ Fck-> BasePath = $ BasePath; // location of the Fckeditor
$ Fck-> ToolbarSet = 'news'; // News is the custom Fckeditor toolbar name.
$ Fck-> Width = '000000'; // length
$ Fck-> Height = '000000'; // Height
$ Fck-> Config ['autodetectlanguage'] = false; // automatic language detection
$ Fck-> Config ['defaultlanguage'] = 'zh-cn'; // language
$ Content = $ fck-> CreateHtml (); // Create a Fckeditor script file
$ Smarty-> assign ('content', $ content );
$ Smarty-> display ("fck. tpl ");
?>


To be displayed in the smarty file

<Tr align = "left">
<Td colspan = "2" valign = "top" bgcolor = "# F5F5F5" class = "font12en">
<{$ Content}>
</Td>
</Tr>

The Default includes all the functions of FCKeditor. I personally feel that some functions are not used, and the full loading will affect the display speed. So I simplified it and only loaded some common functions:
1. Open the FCKeditor/fck_config.js file.

You only need to set $ oFCKeditor-> ToolbarSet = 'default'
Change to $ oFCKeditor-> ToolbarSet = 'WWW '.
Finally, we delete all the directories starting with "_" In the FCKeditor directory to save space, such as _ test. _ samples.

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.