Thinkphp Study 11

Source: Internet
Author: User

First, the use of templates (emphasis)

A, rules

Under Templates folder [tpl]/[Group folder/][template theme Folder/] folder with the same name as module name [index]/and method name file [Index].html (. TPL)

Replace the suffix name of the template file (modify config file) ' Tmpl_template_suffix ' + '. html ',//change template file suffix name

b, modify the template file directory hierarchy ' Tmpl_file_depr ' = ' _ ',//Modify the template file directory hierarchy

C, template theme ' Default_theme ' + ' your ',//Set Default template theme you need to create a new your folder under the TPL as a template theme folder

How do I dynamically modify a template theme?

1. Prepare a function in the background, modify the default template item in the config.php file

2, through the URL pass t= theme parameter can modify different template ' default_theme ' = ' your ',//Set the default template theme ' Tmpl_detect_theme ' =>true,//auto-detect template theme ' theme_l IST ' = ' your,my ',//list of supported template themes

Ii. Output template content (emphasis)

A, display

1.display No Parameters $this->display ();

2. Can take the parameter $this->display (other template files under this module folder); $this->display (' index2 ');

$this->display (template file under other folders); $this->display (' public:error ');///Note that you only need to have the public folder under the TPL and the error.html in it, there is no need to have the public module

$this->display (template file under other subject folder);//need to turn on theme support $this->display (' My:Index:index ');

Thinkphp Study 11

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.