I am a ZF beginner.
I am able to see http://localhost/square/public.
Then I added var/www/square/layouts and master.phtml in the directory.
I have the following /var/www/square/application/configs/appliction.ini
When I visit the same page, it does not show anything.
What am I doing wrong here??
Thanks in advance.
application.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
Note:
-
I set up a virtual host, so I can see it in http://square.localhost, if I take out
resources.layout.layoutPath = APPLICATION_PATH “/layouts”
resources.layout.layout = “master” -
When I echo APPLICATION_PATH in /var/www/square/application/modules/default/views/scripts/index/index.phtml , it outputs /var/www/square/application if I don’t add
resources.layout.layoutPath = APPLICATION_PATH “/layouts”
resources.layout.layout = “master” -
I have given 666 to all files and 777 to all directories.
Update:
Error messages are followings
Fatal error: Uncaught exception
‘Zend_Controller_Router_Exception’
with message ‘Route home is not
defined’ in
/var/www/square/library/Zend/Controller/Router/Rewrite.php:318
Stack trace: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,
‘home’, false, true)2 [internal function]: Zend_View_Helper_Url->url(Array,
‘home’)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’,
Array)5 /var/www/square/application/layouts/master.phtml(15):
Zend_View->url(Array, ‘home’)6 /var/www/square/library/Zend/View.php(108):
include(‘/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 in /var/www/square/library/Zend/Controller/Router/Rewrite.php
on line 318
Update 2.
I am reading a book called Zendframework A Beginner Guide.
I have the following in 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>
I commented out and it shows a page now.
<a href="<?php // echo $this->url(array(), 'home'); ?>">HOME</a>
<a href="<?php // echo $this->url(array('page' => 'services'), 'static-content'); ?>">SERVICES</a>
blank white page means , there is some error but its hidden due to this config :
could you please change to be like this :
and update your question with te error msg
so we can help you 🙂
update
this error indicate that zf trying to find route called
home, routes deceleration usually saved in the
application.ini, so i am not sure if this is ready made application or you are the programmer of this appbut try to look for something like :
in the
master.phtmland again update your question once again with that code snippetupdate 2
i am pretty sure if you had added these 3 lines to your
application.iniand uncomment your code in the layout your problem would be solved