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...