2009-07-26 89 views
0

所以我使用标准的Zend布局为我的网站。我有许多自定义控制器和视图,并且显示了这些页面的内容,但是layout.phtml的head元素中的细节未显示。我是否需要手动将Zend_Layout与每个特定的控制器关联?我期望,因为布局是通过引导加载,这应该是免费的。Zend布局和引导

我app.ini文件有

# layout 
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" 
resources.layout.layout = "layout" 
#resources.view[] = 

# Views 
resources.view.encoding = "UTF-8" 
resources.view.basePath = APPLICATION_PATH "/views/" 

我layout.phtml

<?php echo $this->doctype() ?> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <?php echo $this->headTitle() ?> 
    <?php echo $this->jQuery();?> 
</head> 
<!-- application/layouts/scripts/layout.phtml --> 
<body> 
     <div id="content"> 
      <?php echo $this->layout()->content ?> 
     </div> 
</body> 

+0

给我们的路径布局的目录。它真的在布局/脚本下吗? – 2009-07-26 14:28:09

+0

(不确定)APPLICATION_PATH“/ default/layouts/scripts” – 2009-07-26 14:29:41

回答

1

我用我的初始化程序如下。

Zend_Layout::startMvc(array(
     'layoutPath' => $this->_root . '/application/phpancake/layouts', 
     'layout' => 'main' 
    )); 

_root是路径到其中应用夹所在的目录。
phpancake是模块名称(您的可能是默认)。
布局正在驻留我的布局文件main.phtml