YII implements layout, and yii implements Layout
Layout file:
<Div> I am the header </div> <! -- Display code information such as homepage, logon, and registration --> <! -- $ Content indicates the homepage, logon, registration, and other page information that we have extracted (no header or foot) --> <? Php echo $ content;?> <Div> I am the tail </div>
Location:
The layout file has been implemented. We need to use this layout file below
The default layout file in our system is colum1.php.
Use layout files:
What is the relationship between layout files:
Controller rendering view renderPartial () This method does not render the Layout
The render () method renders the layout.
Now we have completed the layout:
1. Create the layouts/Name of the layout file, and use $ content to represent the common template content.
2. Set the layout file. In the parent class controller, public $ layout = "// layouts/shop ";
3. Call the layout file. Use the method render () in the Controller Method to call the layout file.
Another method is implemented through frameset:
<! -- Set the header, left, and right through the frameset tag set in html --> <! Doctype html public "-// w3c // dtd xhtml 1.0 frameset/en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-frameset.dtd">
In yii, can the layout be used in the modules? Another layout means that one layout at the front end has another layout at the backend.
Certainly. In modules/your module name/components/controller. specify the public $ layout attribute in the php file, which is the name of modules/your module name/views/the layout file name you need ..
Hope to adopt it. If you have any questions, you can ask again.
How does yii remove the original bottom layout?
The default layout file for yii is/view/layout/main. php.
You can directly modify the layout file.
Or you can customize the layout file.
Redefine the following attributes on the Controller
Public $ layout = 'new layout filename ';
You can also disable layout files.
Public $ layout = false;