Php Zend框架中resources.layout存在问题
我是ZF的初学者 我能看见 然后我在目录中添加了var/www/square/layouts和master.phtml。 我有下面的/var/www/square/application/configs/appliction.ini 当我访问同一页时,它没有显示任何内容 我在这里做错了什么 提前谢谢 application.iniPhp Zend框架中resources.layout存在问题,php,zend-framework,layout,Php,Zend Framework,Layout,我是ZF的初学者 我能看见 然后我在目录中添加了var/www/square/layouts和master.phtml。 我有下面的/var/www/square/application/configs/appliction.ini 当我访问同一页时,它没有显示任何内容 我在这里做错了什么 提前谢谢 application.ini [production] phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0
[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
注:
<!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>
更新: 我看到你标记了答案,但我不确定你是否真的解决了这个问题,但看起来你只是缺少了routename
home
的路由定义。如果您定义了这个,那么假设您还有一个名为static\u content
的路由,就应该可以了
当我回显APPLICATION_PATH时,它输出/var/www/square/APPLICATION,但在.ini文件中没有布局
应用程序路径
永远不会有布局。。。它只是应用程序的路径。在文件系统上。另外,如果您没有在虚拟主机中运行此操作,WARE应用程序路径/public
是否为您的文档根目录
,则可能需要设置:
resources.frontController.baseUrl=“/square/public”
为了让所有的信号都正常工作。。。默认情况下,假定应用程序路径/public
是您的文档的根目录
你可能在什么地方出错了。修改index.php以使用开发环境,这样您将看到错误和异常(如果有)。然后用这些细节更新你的问题。更新:
我看到你标记了答案,但我不确定你是否真的解决了这个问题,但看起来你只是缺少了routenamehome
的路由定义。如果您定义了这个,那么假设您还有一个名为static\u content
的路由,就应该可以了
当我回显APPLICATION_PATH时,它输出/var/www/square/APPLICATION,但在.ini文件中没有布局
应用程序路径
永远不会有布局。。。它只是应用程序的路径。在文件系统上。另外,如果您没有在虚拟主机中运行此操作,WARE应用程序路径/public
是否为您的文档根目录
,则可能需要设置:
resources.frontController.baseUrl=“/square/public”
为了让所有的信号都正常工作。。。默认情况下,假定应用程序路径/public
是您的文档的根目录
你可能在什么地方出错了。修改index.php以使用开发环境,这样您将看到错误和异常(如果有)。然后用这些详细信息更新您的问题。空白白页表示存在一些错误,但由于此配置而隐藏:
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
resources.frontController.params.displayExceptions = 0
你能换成这样吗
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
并用te error msg更新您的问题
所以我们可以帮助您:)
更新
此错误表示zf试图查找名为home
,通常保存在应用程序.ini
中,因此我不确定这是现成的应用程序还是您是此应用程序的程序员
但试着寻找类似的东西:
$this->url(<!-- i am not sure what you might here but it usually array of module , controller , action --> , "home") ;
空白白色页面表示存在一些错误,但由于此配置而隐藏:
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
resources.frontController.params.displayExceptions = 0
你能换成这样吗
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
并用te error msg更新您的问题
所以我们可以帮助您:)
更新
此错误表示zf试图查找名为home
,通常保存在应用程序.ini
中,因此我不确定这是现成的应用程序还是您是此应用程序的程序员
但试着寻找类似的东西:
$this->url(<!-- i am not sure what you might here but it usually array of module , controller , action --> , "home") ;
申,