How to import fckeditor into Php+smarty _php tutorial

Source: Internet
Author: User
Tags php programming

Implementation method of importing FCKeditor into Php+smarty


This article mainly introduces the implementation of FCKeditor into php+smarty, involving the integration of FCKeditor and smarty skills, very practical value, the need for friends can refer to the following

This article describes the implementation method of importing FCKeditor into Php+smarty. Share to everyone for your reference. The specific analysis is as follows:

When extracting FCKeditor, use the following, PHP with $_post[' P_info '] to get the value of FCKeditor.

Add:

1. The path to basepath here must be the same as the path of the include above. Otherwise, the file will not be found.

In addition, for this input variable, if you want to save it in the database tutorial, its variable name is the name of the object you created. For example, the above is "P_info".

2. There is an example of PHP tutorial invocation in fckeditor/_samples/. Two, such as simples01.php and sampleposteddata.php. The later file is the PHP program that outputs the variable name, This program allows you to get a variable name for the contents of the text input box.

3. Configure the FCKeditor toolbar Function button can be easily customized, you can according to your needs in the FCKeditor configuration file fckeditor/fck_config.js to customize a function button corresponding to a unique name.

In Fck_config.js, three toolbar styles have been set by default (all functions included), 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 '],//toolbar first line
[' Item 4 ', '-', ' Item 5 ', ' Item 6 ', ' Item n ']//toolbar second line
];


The function of '-' here is to create a split bar.

The instance code is as follows:

The code is as follows:

$BasePath = ". /include/fckeditor/";
Include ($BasePath. "fckeditor.php");
$FCK = new FCKeditor (' P_info ');//Create a pair of images
$FCK-basepath = $BasePath; where//fckeditor is located
$FCK-toolbarset = ' News ';//news is the custom fckeditor toolbar name
$FCK Width = ' 700 ';//length
$FCK, height = ' 350 ';//height
$FCK Config [' autodetectlanguage '] = false;//language automatic detection
$FCK Config [' defaultlanguage ']= ' ZH-CN ';//language
$content = $fck createhtml ();//Create FCKeditor script file
$smarty-Assign (' content ', $content);
$smarty, display ("Fck.tpl");
?>


Places to display in Smarty files:

The code is as follows:



<{$content}>


The default defaults contain all the functions of the fckeditor, the individual feel that some functions are not used, the full load will also affect the display speed, so I simplified a bit, only loaded with some common features:

Open Fckeditor/fck_config.js File:

Only use the

The code is as follows:

$oFCKeditor->toolbarset = ' Default '

Switch

The code is as follows:

$oFCKeditor->toolbarset = ' www '

Then, finally, we delete all the directories under the FCKeditor directory that begin with the underscore "_" to save space, such as _test._samples.

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/971933.html www.bkjia.com true http://www.bkjia.com/PHPjc/971933.html techarticle implementation method of importing FCKeditor into Php+smarty This article mainly introduces the implementation of FCKeditor import Php+smarty, involving the integration of FCKeditor and smarty skills, very practical value, need ...

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