为了让不同的view以相同的布局进行显示,我们可以编写布局模板文件,并以layout.phtml为名称进行保存,并在index.php中指定这个文件所在的位置。
- require_once'Zend/Layout.php';
- Zend_Layout::startMvc(array('layoutPath'=>'../application/default/layouts'));
在布局文件中,我们可以指定网页需要使用的样式文件,JavaScript脚本文件。
"Content-Type"c/span>"text/html;charset=utf-8"/> - $request=Zend_Controller_Front::getInstance()->getRequest();
- $this->headTitle('视图中使用视图')
- ->headTitle($request->getModuleName())
- ->headTitle($request->getActionName())
- ->headTitle($request->getControllerName())
- ->setSeparator('|');
- echo$this->headTitle();
- $this->headLink()->appendStylesheet($this->baseUrl."/css/style.css")
- ->appendStylesheet($this->baseUrl."/css/demo.css");
- echo$this->headLink();
- $this->headScript()->appendFile($this->baseUrl."/js/jquery-1.2.6.js")
- ->appendFile($this->baseUrl."/js/jquery.datePicker.js")
- ->appendFile($this->baseUrl."/js/demo.js");
- echo$this->headScript();
- ?>
'bodywrapper'> 'header'> - echo$this->partial('header.phtml','default');?>
'sidebar'> - echo$this->partial('leftside.phtml','default');?>
'midcontent'> - echo$this->layout()->content;?>
'footer'> - echo$this->partial('footer.phtml','default');?>
版权声明:本文为博主原创文章,未经博主允许不得转载。
以上就介绍了Zend Framework之Layout,包括了require方面的内容,希望对PHP教程有兴趣的朋友有所帮助。










