ThinkPHP method for using the smarty template engine

Source: Internet
Author: User

ThinkPHP supports multiple php template engines and can be configured as needed.
The following uses the Smarty template engine as an example to describe the specific operation process!

First download a Smarty from the Smarty official website. Site:
Next, decompress the package and there will be two folders: demo and libs. Open the libs folder and copy all the content.
Next, open the thinkphp folder under the root directory of your website. There is a vendor folder, which is used by TP to call a third-party class library. paste all the copied items.
Then open the configuration file of your project. The file conf. php should be in the conf directory of your project directory.

Add the following Configuration:

'Tmpl _ ENGINE_TYPE '=> 'smarty'

If you want to configure more, you can add

'Tmpl _ ENGINE_CONFIG '=> array ('caching' => true, 'template _ dir' => TMPL_PATH, 'compile _ dir' => CACHE_PATH, 'cache _ dir' => TEMP_PATH)

In this way, you can use the Smarty template.

The file location of the template has not changed, and the cache location has not changed.

Related Article

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