ThinkPHP2.0 adjusting the use of smarty templates

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

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