This article is the Zend framework in the layout (modular layout) for a detailed analysis of the introduction, the need for friends to refer to the
1. First modify the application configuration file
Resources.layout.layoutPath = Application_path "/layouts/scripts"
Specify the location of the layout file
2. The easiest way to do this is to modify the boot file bootstrap.php file to add an automated method:
protected function _initdoctype () {}
3. Add one to our configuration text
resources.view[] =
Here we assign a value to the view, although he is just a null value ~
4. Add in our Boot file
Copy Code code as follows:
protected function _initdoctype ()
{
$this->bootstrap (' view ');//Open View
$view = $this->getresource (' view ');//attempt to get the document. defined in the master configuration
$view->doctype (' xhtml1_strict '); Set Document Type
}
5. Finally, let's add a layout.html file to the application/layouts/scripts/
content is:
Copy Code code as follows:
<?php Echo $this->doctype ()
<meta http-equiv= "Content-type" content= "text/html; charset=utf-8"/>
<title>zend Framework Quickstart application</title>
<?php echo $this->headlink ()->appendstylesheet ('/css/global.css '
<body>
<div id= "header" style= "Background-color: #EEEEEE; height:30px;"
<div id= "Header-logo" style= "Float:left" mce_style= "Float:left"
<b>zf Quickstart Application</b>
</div>
<div id= "header-navigation" style= "Float:left" mce_style= "Float:left"
<a href= "<?php echo $this->url (
Array (' controller ' => ' guestbook '),
' Default ',
true? > >guestbook</a>
</div>
</div>
<?php echo $this->layout ()->content?
</body>