Combination of fck and smarty

Source: Internet
Author: User

Configuration File

<?
$ Basepath = "../include/FCKeditor/"; // defines the path, where des is a third-level path.
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
<Tr align = "Left">
<TD colspan = "2" valign = "TOP" bgcolor = "# f5f5f5" class = "font12en">
<{$ Content}>
</TD>
</Tr>
When extracting FCKeditor, use the following
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, its variable name is
Object Name. For example"p_info"

2.There is an example of PHP calling in FCKeditor/_ samples/, for example, simples01.php.
And sampleposteddata. php. The file that follows is the PHP that outputs the variable name.
Program to get the variable name in the text input box.

3.You can easily customize the toolbar function button of FCKeditor.
In the FCKeditor configuration file FCKeditor/fck_config.js.
A function button corresponds to a unique name.
In fck_config.js, three toolbar styles have been set by default: default (Package
Including all functions), accessibility and basic.

 

 

------- Combination Configuration

1. files that call FCKeditor in smarty:
<? PHP
Require_once ("Class/smarty. Class. php ");
Require_once ('fckeditor/FCKeditor. php'); // import FCKeditor

/* Instance and initial FCKeditor */
$ Editor = new FCKeditor ("content"); // content in $ _ post ['...'] During receiving
$ Editor-> basepath = "../FCKeditor/"; // path of FCKeditor
$ Editor-> toolbarset = "Basic ";
$ Editor-> value = "";
$ FCKeditor = $ Editor-> createhtml (); // create an editor, which is the HTML result code.

/* Instance and initial smarty */
$ Smarty = new smarty ();
$ Smarty-> template_dir = "../templates ";
$ Smarty-> compile_dir = "../templates_c ";
$ Smarty-> left_delimiter = "<{";
$ Smarty-> right_delimiter = "}> ";
$ Smarty-> assign ('title', "Rossy is here waiting for you ");
$ Smarty-> assign ('fckeditor', $ FCKeditor); // Replace the FCKeditor tag
$ Smarty-> display ('template. TPL ');
?>

Ii. template. TPL
<Htm>
<Head>
<Title> example of smarty use FCKeditor </title>
</Head>
<Body>
<P> example </P>
<P> title: <{$ title}> </P>
<P> </P>
<P> content: </P>
<P> <{$ FCKeditor}> </P>
</Body>
</Html>

3. Get the pass value getvalue. php of FCKeditor
<? PHP
Echo $ _ post ["content"];
?>

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.