Thinkphp template inclusion and rendering instance Analysis _ php instance

Source: Internet
Author: User
This article mainly introduces the inclusion and rendering of thinkphp templates. The example analyzes the usage and related skills of template inclusion and rendering. it is a practical technique, for more information about the thinkphp template, see the examples in this article. Share it with you for your reference. The specific analysis is as follows:

I. template inclusion

The code is as follows:



// Call the read template under the same directory




In the template, the variables are accepted using [variables ].

The code is as follows:

II. Template rendering

1. automatically enable the template rendering settings configuration file, replace the specific content in the file, and assemble it into a complete page.

The code is as follows:

'Layout _ on' => true, // enable template rendering

In the Public directory, prepare a layout template to render the page, and use {__ CONTENT __} to reference the CONTENT of the specific template page in the page.

If you do not want to use a rendering template in a specific template, you can add {__ NOCONTENT __} on the top __}

2. if you do not enable automatic template rendering, you can add

The code is as follows:

I hope this article will help you with ThinkPHP framework programming.

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.