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.