Detailed explanation of layout (modular layout) in the Zend Framework

Source: Internet
Author: User
Tags php file zend zend framework
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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.