This article describes how to call FCKeditor in Smarty. Compared with common error methods, it describes how to call FCKeditor in Smarty. it is a very practical technique, for more information about how to call FCKeditor in Smarty, see the following example. The specific implementation method is as follows:
FCKeditor is currently the best online editor on the Internet.
Smarty is a PHP template engine written using PHP. It provides the separation of logic and external content. In short, it aims to separate PHP programmers from the artist, changing the logic content of a program by a programmer does not affect the page design of the artist. modifying the page by the artist does not affect the program logic. This is especially important in projects that involve multiple partners.
Files that call FCKeditor in Smarty:
The code is as follows:
Require_once ("conn. php ");
Require_once ("class/Smarty. class. php ");
$ Smarty = new Smarty ();
$ Smarty-> template_dir = "../templates ";
$ Smarty-> compile_dir = "../templates_c ";
$ Smarty-> left_delimiter = "<{";
$ Smarty-> right_delimiter = "}> ";
$ Editor = new FCKeditor ("Content ");
$ Editor-> BasePath = "../FCKeditor /";
$ Editor-> ToolbarSet = "Basic ";
$ Editor-> Value = "";
$ FCKeditor = $ editor-> CreateHtml ();
$ Smarty-> assign ('title', "Rossy is here waiting for you ");
$ Smarty-> assign ('fckeditor', $ FCKeditor );
$ Smarty-> display ('Template. tpl ');
However, FCKeditor cannot pass the value when editing the data. it only generates a null editor. Therefore, you can only use the following method:
The code is as follows:
Require_once ("conn. php ");
Require_once ("class/Smarty. class. php ");
$ Smarty = new Smarty ();
$ Smarty-> template_dir = "../templates ";
$ Smarty-> compile_dir = "../templates_c ";
$ Smarty-> left_delimiter = "<{";
$ Smarty-> right_delimiter = "}> ";
$ Editor = new FCKeditor ("Content ");
$ Editor-> BasePath = "../FCKeditor /";
$ Editor-> ToolbarSet = "Basic ";
$ Editor-> Value = "Here is a example of smarty and FCKeditor ";
$ Smarty-> assign ('title', "Rossy is here waiting for you ");
$ Smartyl-> assign_by_ref ("FCKeditor", $ editor );
$ Smarty-> display ('Template. tpl ');
Template. tpl:
The code is as follows:
Example of smarty use fckeditor
Example
Title: <{$ Title}>
Content:
<{$ FCKeditor}>
I hope this article will help you with PHP programming.