Detailed description of Layout in zendFramework (modular Layout) _ PHP Tutorial

Source: Internet
Author: User
Detailed description of Layout in zendFramework. 1. first, modify the application configuration file resources. layout. layoutPathAPPLICATION_PATHlayoutsscripts to specify the location of the layout file. 2. then, the easiest way is to modify the boot file. 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, 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?>



View the page content. if there is a horizontal bar, it indicates that it is successful and it will appear on all pages!

Export resources. layout. layoutPath = APPLICATION_PATH "/layouts/scripts" specify the location of the layout file 2. then the simplest way is to modify the boot file...

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.