The implementation method of introducing FCKeditor into Php+smarty _php skills

Source: Internet
Author: User
Tags php tutorial

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

When extracting fckeditor, it is used as follows, PHP uses $_post[' p_info ' to get fckeditor value.

Add:

1. The path BasePath here must be the same as the path 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 top is "P_info".

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

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

Three toolbar styles are already set in Fck_config.js by default: Default (Contains all features), accessibility and basic.

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

Copy Code code 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 here is to create a split bar.

The instance code is as follows:

Copy Code code as follows:
<?php
$BasePath = ". /include/fckeditor/";
Include ($BasePath. "fckeditor.php");
$FCK = new FCKeditor (' P_info ');
$FCK-> basepath = $BasePath; Location of//fckeditor
$FCK-> toolbarset = ' News '//news custom fckeditor toolbar name
$FCK-> Width = ' 700 ';//length
$FCK-> height = ' 350 ';//Altitude
$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");
?>

Where to display in Smarty files:
Copy Code code as follows:
<tr align= "Left" >
<TD colspan= "2" valign= "Top" bgcolor= "#F5F5F5" class= "Font12en" >
<{$content}>
</td>
</tr>

Default defaults include all the features of the fckeditor, personal feeling that some features are not used, full load will also affect the display speed, so I simplified, only loaded a number of commonly used features:

Open Fckeditor/fck_config.js File:

Use only to

Copy Code code as follows:
$oFCKeditor->toolbarset = ' Default '
To
Copy Code code as follows:
$oFCKeditor->toolbarset = ' www '
Then, finally, we delete all the following FCKeditor directory "_" to save space, such as _test._samples.

I hope this article will help you with your PHP program design.

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.