In the process of development, often encountered to make each template page contains a header file and a footer file, thinkphp template layout provides us with a call to the global configuration method to solve the problem.
1. Turn on the layout_on parameter in the configuration file (not on by default) and set the layout entry file name Layout_name (default to Layout)
' layout_on ' =>true, ' layout_name ' and ' LAYOUT ',
2. Create a layout.html file in the template directory with the following code in the file:
<include file= "Public:header"/> {__content__} <include file= "Public:footer"/>
{__content__} is a specific word substitution string, if the template reads the layout template for user/add.html,thinkphp, the user/add.html template file is parsed and the parsed content is replaced with the layout template file { __CONTENT__} specific string.
3.
' Tmpl_layout_item ' = ' {__replace__} '//change this specific replacement string by setting
' Layout_name ' = ' layout/layoutname ',//Specify layout templates for other locations
A more detailed introduction: http://www.thinkphp.cn/info/183.html