Detailed description of Layout in zendFramework

Source: Internet
Author: User
This article provides a detailed analysis of Layout (modular Layout) in zendFramework. For more information, see

This article provides a detailed analysis of Layout (modular Layout) in zend Framework. For more information, see

1. First modify the application configuration file
Resources. layout. layoutPath = APPLICATION_PATH "/layouts/scripts"
Location of the layout File

2. The simplest method is to modify the bootstrap. php file to add an automatic execution method:
Protected function _ initDoctype (){}

3. Add
Resources. view [] =
Here we assign a value to the view, which is an American space, although it is only a null value ~

4. Add the following content to our boot file:

The Code is as follows:


Protected function _ initDoctype ()
{
$ This-> bootstrap ('view'); // enable the view
$ View = $ this-> getResource ('view'); // The attempt to obtain the document is defined in the main configuration.
$ View-> doctype ('xhtml1 _ STRICT '); // you can specify the document type.
}


5. Add a Layout. HTML file under application/layouts/scripts /.
Content:

The Code is as follows:


Doctype ()?>



Zend Framework Quickstart Application
HeadLink ()-> appendStylesheet ('/css/global.css')?>




ZF Quickstart Application



Url (
Array ('controller' => 'guestbook '),
'Default ',
True)?> "> Guestbook



Layout ()-> content?>



Then, view the page content. If there is a horizontal bar on the Hong Kong server, it indicates that the page is successful and will appear on all pages!

, Hong Kong Space

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.