ThinkPHP2.0 Integration using Smarty templates
Smarty Official website: http://www.smarty.net/download
How it's done:
1. First go to smarty official online download a smarty, then unzip the package, there will be two folders: Demo and libs. Open the Libs folder and copy all content under LIBS (not including Libs).
2. Open the Thinkphp folder in the root directory of your website. There is a vendor folder, this folder is TP call third-party class library used
3. Create a new Smarty directory under vendor and paste all the things you just copied.
4. Open your project's configuration file (project root/conf/config.php), you should conf.php this file in the Conf directory of your project directory.
Add the following configuration:
' Tmpl_engine_type ' = ' Smarty '
If you want to configure more, you can also add
' Tmpl_engine_config ' =>array (????
????' Caching ' =>true,????
????' Template_dir ' =>tmpl_path,????
????' Compile_dir ' =>cache_path,????
????' Cache_dir ' =>temp_path????
)
This way you can use the Smarty template.
Add one point:
I think the tutorial is to directly copy all the files under the Libs directory to vendor, then you need to do the following:
thinkphp/lib/think/util/template/templatesmarty.class.php file need to put 41 lines of the? Vendor (' Smarty.smarty#class '); Change to Vendor (' Smarty#class ');?? Because the directory as above is not built in the vendor directory under the Smarty directory.