【发布时间】:2011-05-31 14:59:51
【问题描述】:
我是 ZF 初学者。
我可以看到http://localhost/square/public。
然后我在目录中添加了 var/www/square/layouts 和 master.phtml。 我有以下 /var/www/square/application/configs/appliction.ini
当我访问同一页面时,它没有显示任何内容。
我在这里做错了什么??
提前致谢。
应用程序.ini
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules = ""
resources.layout.layoutPath = APPLICATION_PATH "/layouts"
resources.layout.layout = "master"
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
注意:
我设置了一个虚拟主机,所以我可以在http://square.localhost看到,如果我拿出 resources.layout.layoutPath = APPLICATION_PATH "/layouts" resources.layout.layout = "主"
-
当我在 /var/www/square/application/modules/default/views/scripts/index/index.phtml 中回显 APPLICATION_PATH 时,如果我不添加,它会输出 /var/www/square/application
resources.layout.layoutPath = APPLICATION_PATH "/layouts" resources.layout.layout = "主"
我已将 666 分配给所有文件,将 777 分配给所有目录。
更新:
错误信息如下
致命错误:未捕获的异常 'Zend_Controller_Router_Exception' 带有消息'路由回家不是 定义'在 /var/www/square/library/Zend/Controller/Router/Rewrite.php:318 堆栈跟踪:
0 /var/www/square/library/Zend/Controller/Router/Rewrite.php(464): Zend_Controller_Router_Rewrite->getRoute('home')
1 /var/www/square/library/Zend/View/Helper/Url.php(49): Zend_Controller_Router_Rewrite->assemble(Array, '家',假,真)
2 [内部函数]: Zend_View_Helper_Url->url(Array, '家')
3 /var/www/square/library/Zend/View/Abstract.php(342): call_user_func_array(Array, Array)
4 /var/www/square/application/layouts/master.phtml(15): Zend_View_Abstract->__call('url', 数组)
5 /var/www/square/application/layouts/master.phtml(15): Zend_View->url(Array, 'home')
6 /var/www/square/library/Zend/View.php(108): 包括('/var/www/square...')
7 /var/www/square/library/Zend/View/Abstract.php(880): Zend_View->_run('/var/www/square...')
8 /var/www/square/library/Zend/Layout.php(796): Zend_View_Abstract->render('master.phtml')
9 在 /var/www/square/library/Zend/Controller/Router/Rewrite.php 在第 318 行
更新 2。
我正在阅读一本名为 Zendframework A Beginner Guide 的书。
我在 master.phtml 中有以下内容
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<base href="/" />
<link rel="stylesheet" type="text/css" href="/css/master.css" />
</head>
<body>
<div id="header">
<div id="logo">
<img src="/images/logo.gif" />
</div>
<div id="menu">
<a href="<?php echo $this->url(array(), 'home'); ?>">HOME</a>
<a href="<?php echo $this->url(array('page' => 'services'), 'static-content'); ?>">SERVICES</a>
<a href="#">CONTACT</a>
</div>
</div>
<div id="content">
<?php echo $this->layout()->content ?>
</div>
<div id="footer">
<p>Created with <a href="http://framework.zend.com/">Zend Framework</a>. Licensed under <a href="http://www.creativecommons.org/">Creative Commons</a>.</p>
</div>
</body>
</html>
我注释掉了,它现在显示一个页面。
<a href="<?php // echo $this->url(array(), 'home'); ?>">HOME</a>
<a href="<?php // echo $this->url(array('page' => 'services'), 'static-content'); ?>">SERVICES</a>
【问题讨论】:
标签: php zend-framework layout