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.