Zend framework Zend布局和引导
所以我在我的网站上使用标准的Zend布局。我有许多自定义控制器和视图,这些页面的内容会显示出来,但layout.phtml的head元素中的细节不会显示出来。我是否需要手动将Zend_布局与每个特定控制器关联?。我预计,由于布局是通过引导加载,这应该是免费的 我的app.ini文件已被删除Zend framework Zend布局和引导,zend-framework,Zend Framework,所以我在我的网站上使用标准的Zend布局。我有许多自定义控制器和视图,这些页面的内容会显示出来,但layout.phtml的head元素中的细节不会显示出来。我是否需要手动将Zend_布局与每个特定控制器关联?。我预计,由于布局是通过引导加载,这应该是免费的 我的app.ini文件已被删除 # layout resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" resources.layout.layout = "la
# 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/"
my 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>
我在我的初始值设定项中使用以下内容
Zend_Layout::startMvc(array(
'layoutPath' => $this->_root . '/application/phpancake/layouts',
'layout' => 'main'
));
_root是应用程序文件夹所在目录的路径。phpancake是模块名称(您的可能是默认名称)。
layouts是我的布局文件main所在的目录。phtml为我们提供布局的路径。它真的在layouts/scripts下吗?(不确定)APPLICATION\u PATH“/default/layouts/scripts”应该放在哪个初始值设定项上?我想问的是,如果我在
\u initLayout()
方法中使用您的代码,它会给出一个空白页。