<title>thinkphp make each template page contain a header file followed by a footer file-PHP</title>
Home Page
- Web Development
- Android
- J2ee
- Php
- Linux/unix
- Mysql
- C#
- More...
Current Location: Code geek»php»thinkphp make each template page contain a header file followed by an F
thinkphp make each template page contain a header file followed by a footer file
Www.MyException.Cn, Netizens share in: 2014-06-30 Views: 6 times
thinkphp make each template page contain a header file and a footer file
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:
{__content__}
{__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