How to import FCKeditor into PHP + SMARTY

Source: Internet
Author: User
This article mainly introduces how to import FCKeditor into PHP + SMARTY. It involves the integration of FCKeditor and SMARTY. It is very useful. For more information, see

This article mainly introduces how to import FCKeditor into PHP + SMARTY. It involves the integration of FCKeditor and SMARTY. It is very useful. For more information, see

This example describes how to import FCKeditor into PHP + SMARTY. Share it with you for your reference. The specific analysis is as follows:

The following code is used to extract Fckeditor. 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 store the input variable in the database tutorial, its variable name is the name of the object you created. For example, the above is "p_info ".

2. in FCKeditor/_ samples/, there is an example of php tutorial calling. for example, simples01.php and sampleposteddata. php. the following file is the php program that outputs the variable name. You can use this program to obtain the variable name in the text input box.

3. you can easily customize the toolbar function button of FCKeditor. You can customize a function button in the FCKeditor configuration file FCKeditor/fck_config.js according to your needs, corresponding to a unique name.

In fck_config.js, three toolbar styles have been set by Default: Default (including all functions), Accessibility and Basic.

Let's take a look at the custom format of the toolbar style:

The Code is as follows:

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 entry.

The instance code is as follows:

The Code is as follows:

<? Php
$ 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:

The Code is as follows:



<{$ Content}>


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:

Open the FCKeditor/fck_config.js file:

You only need

The Code is as follows:

$ OFCKeditor-> ToolbarSet = 'default'

Changed:

The Code is as follows:

$ OFCKeditor-> ToolbarSet = 'www'

Finally, all the directories starting with _ in the FCKeditor directory are deleted to save space, such as _ test. _ samples.

I hope this article will help you with php programming.

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.