How to import FCKeditor into PHP + SMARTY _ PHP Tutorial

Source: Internet
Author: User
Import FCKeditor into PHP + SMARTY. This article describes how to import FCKeditor into PHP + SMARTY. it involves the techniques of integrating FCKeditor with SMARTY and is of great practical value, how to import FCKeditor into PHP + SMARTY

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:

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

This article introduces how to import FCKeditor into PHP + SMARTY. it involves integrating FCKeditor and SMARTY...

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.