How to call FCKeditor in Smarty

Source: Internet
Author: User
Tags php template
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.

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.