Considerations for migrating Smarty Templates with TP templates in TP frame

Source: Internet
Author: User
Tags smarty template

Thinkphp process and considerations for using the Smarty template engine
In the multi-person cooperation project, the Smarty template uses the most, the specific reason Baidu.

The template used by default in thinkphp is Think's own template, which requires modifying the default template engine variables.

The steps are as follows:


① defines the following configuration items in config.php

' Tmpl_engine_type ' = ' Smarty ',
② previous step has switched the template engine, CSS style if there is {}, you need to use the {literal} tag to prohibit Smarty parsing, using the {literal}{/literal} tag is included.

③ If you use custom system variables such as $think.const.css_url (note that you can use the thinkphp template, such as the abbreviated form of $think.css_url, if the industry CSS references However, you cannot omit const! when switching to a smarty template. Change the keyword $think to $smarty (note that the beginning of the letter is lowercase).

The ④TP engine replaces key constants such as __controller__ __module__, etc., Smarty engine is not replaced and needs to be set to: {$smarty. const.__controller__} parsed out.

Considerations for migrating Smarty Templates with TP templates in TP frame

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.