ThinkPHP2.0 adjusts the Smarty Template

Source: Internet
Author: User
ThinkPHP2.0 integrated use of Smarty template Smarty official website: Workshop. Open the libs folder and use the Smarty template in ThinkPHP2.0.

Smarty official website: http://www.smarty.net/download

How to operate:

1. first download a Smarty from The Smarty official website, and then extract the compressed package. There are two folders: demo and libs. Open the libs folder and copy all contents under libs (excluding libs ).

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

3. create a Smarty directory under the vender and paste all the copied items.

4. open the configuration file of your project (/Conf/config. php under the root directory of the 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.


Add:
I have read some tutorials to directly copy all files under the libs directory to the Vendor directory, so you need to perform the following operations:
In the ThinkPHP/Lib/Think/Util/Template/TemplateSmarty. class. php file, do you need to set the 41 rows? Vendor ('smarty. Smarty # class ');?? Change it to vendor ('smarty # class ');?? Because the Smarty directory is not created under the Vendor Directory according to the above directory.

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.