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