Layout of in zend Framework modular layout details
- 2020-06-23 00:06:03
- OfStack
1. First, modify the application configuration file
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
Specifies the location of the layout file
2. Then the easiest way is to modify the boot file bootstrap.php to add an automatic method:
protected function _initDoctype() { }
3. Add 1 to our configuration
resources.view[] =
Here we assign a value to the view, although it is only a null value ~
4. Add to our boot file
protected function _initDoctype()
{
$this->bootstrap('view');// Open the view
$view = $this->getResource('view');// An attempt to obtain a document . Defined in the master configuration
$view->doctype('XHTML1_STRICT'); // Set the document type
}
5. Finally, let's add one Layout. HTML file under application/layouts/scripts/
Content as follows:
<?php echo $this->doctype() ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<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') ?>
</head>
<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>
</html>
Then look at the page content, if there is 1 bar, it is a success, it will appear in all pages!