Zend Framework之Layout

WBOY
Release: 2016-07-29 09:14:01
Original
1093 people have browsed it

In order to display different Views with the same layout, we can write a layout template file, save it as layout.phtml, and specify the location of this file in Index.php.

  1. require_once'Zend/Layout.php';
  2. Zend_Layout::startMvc(array('layoutP ath'=>'. ./application/default/layouts'));

In the layout file, we can specify the style files and JavaScript script files that the web page needs to use.

  1. "Content-Type"c/span>"text/html; charset= utf-8"/> -> headTitle(
  2. 'Use view in view')
  3. ->headTitle($request
  4. ->getModuleName())->headTitle($request ->getActionName())
  5. ->headTitle($request->getControllerName())
  6. ->setSeparator('|');
  7. echo$this
  8. ->headTitle();
  9. $this->headLink()->appendStylesheet(
  10. $this
  11. ->baseUrl."/ css/style.css")
  12. ->appendStylesheet($this->baseUrl."/css/demo.css");echo
  13. $this->headLink();$this->headScript()->appendFile(
  14. $this
  15. ->baseUrl."/js/jquery- 1.2.6.js")
  16. ->appendFile($this->baseUrl."/js/jquery.datePicker.js")-& gt ;appendFile(
  17. $this->baseUrl."/js/demo.js");echo
  18. $this->headScript(); ?>
  19. 'bodywrapper'>
  20. < divid=
  21. 'header' >
  22. echo$this
  23. ->partial('header.phtml','default'
  24. );?> 'leftside .phtml','default');?>
  • 'midcontent'> < ?php
  • echo$this->layout()->content;?>
  • 'footer'> ;
  • echo$this->partial('footer.phtml'
  • ,'default');?> < ;/div>
  • No reproduction allowed.
  • The above introduces the layout of Zend Framework, including the require content. I hope it will be helpful to friends who are interested in PHP tutorials.
  • Related labels:
    source:php.cn
    Previous article:How dependent are we on technology? Why do programmers care about it? —Brothers IT Education Next article:Several ways for nginx load balancer to handle session sharing
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Latest Articles by Author
    Latest Issues
    Related Topics
    More>
    Popular Recommendations
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!