Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 01-28-2008, 02:54 PM
Junior Member
 
Join Date: Jan 2008
Posts: 8
Default

I've listed my step by step instructions on how I setup the application environment here with screenshots.

Application Setup Steps

Thanks for your help.

If you need more details, let me know.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 01-28-2008, 03:57 PM
Junior Member
 
Join Date: Nov 2007
Location: Sweden
Posts: 12
Default

Never seen someone supply so much information before...perfect...will make it a bit easier(hopefully), to find the error.

What I can see now is that you are missing the display.phtml and index.pthml file.

Inside the "include" directory create a directory with the name "views" in that folder create a folder with the name "scripts". In the "scripts" folder create two folders with the name "index" and "news".

Within the "index" directory create the file "index.phtml" and in the "news" directory create "default.phtml" and "index.phtml"

All the above is the get the Zend Framework to work properly...I have never used the smarty template so can't say anything about that. You can find the proper directory structure here.

Summary
What I'm trying to explain above is that in your "views/scripts" folder, you will need a folder for each controller you have. If you have a FooController, you will need a "foo" directory in the "views/scripts" folder. If you have a BarController you will need a folder named "bar" in the "views/scripts" folder.

Now let's take it a step further. For each Action in your Controllers you will need a .phtml (php+html, non-official filextension, just commonly used). With the actions name, indexAction will need a index.phtml and your displayAction will require a display.phtml in the correct directory.

Last edited by Holmen : 01-28-2008 at 04:03 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 01-30-2008, 03:59 AM
Junior Member
 
Join Date: Jan 2008
Posts: 8
Default

Quote:
Originally Posted by Holmen View Post
Never seen someone supply so much information before...perfect...will make it a bit easier(hopefully), to find the error.

What I can see now is that you are missing the display.phtml and index.pthml file.

Inside the "include" directory create a directory with the name "views" in that folder create a folder with the name "scripts". In the "scripts" folder create two folders with the name "index" and "news".

Within the "index" directory create the file "index.phtml" and in the "news" directory create "default.phtml" and "index.phtml"

All the above is the get the Zend Framework to work properly...I have never used the smarty template so can't say anything about that. You can find the proper directory structure here.

Summary
What I'm trying to explain above is that in your "views/scripts" folder, you will need a folder for each controller you have. If you have a FooController, you will need a "foo" directory in the "views/scripts" folder. If you have a BarController you will need a folder named "bar" in the "views/scripts" folder.

Now let's take it a step further. For each Action in your Controllers you will need a .phtml (php+html, non-official filextension, just commonly used). With the actions name, indexAction will need a index.phtml and your displayAction will require a display.phtml in the correct directory.
thanks so much for your help! im gonna try that this week, the book im following has code but it doesn't seem to work
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 02-08-2008, 08:30 AM
Junior Member
 
Join Date: Feb 2008
Posts: 3
Default

Quote:
Originally Posted by shibuya View Post
Can anyone pinpoint what the exact problem from this fatal error message?

Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)'
<snip>

It's been rattling me and I need to figure this out to continue.
Hey Shibuya,
I am having the same problems (appearently using the same book )

i did figure out something.

The problem lies in the CustomControllerAction.php

in the controllers (ie IndexController.php etc) you extend to the CustomControllerAction (class IndexController extends CustomControllerAction)
which give the fatal error.

if you replace CustomControllerAction and use the Zend_Controller_Action instead it does work as intended. ( class IndexController extends Zend_Controller_Action)

i know this isnt the valid way to do, and dont ask me why extending the customcontrolleraction doesnt work. i am lacking the indepth php knowledge for that

but perhaps some other people know what is wrong with the CustomControllerAction.php (code below)

Code:
<?php
class CustomControllerAction extends Zend_Controller_Action
{
public $db;
public function init()
{
$this->db = Zend_Registry::get('db');
}
}
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 02-08-2008, 11:58 AM
Member
 
Join Date: Aug 2007
Location: Sweden
Posts: 52
Send a message via MSN to Leif.Högberg
Default

Nothing wrong with the code you posted..
But make sure that you have stored something in Zend_Registry 'db' (probably done in bootstrap)
And also remove the '?>' from the last line to make sure the problem isn't caused by a trailing whitespace.

What book is it that you are reading?
A good practice, since ZF is so new and still undergoing a lot of changes, would be to cross-reference everything you read with the online docs.
Chances are that whatever is printed in that book is outdated. The same goes for most tutorials that can be found online.

Last edited by Leif.Högberg : 02-08-2008 at 12:01 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 02-08-2008, 12:10 PM
Junior Member
 
Join Date: Feb 2008
Posts: 3
Default

Quote:
Originally Posted by Leif.Högberg View Post
Nothing wrong with the code you posted..
But make sure that you have stored something in Zend_Registry 'db' (probably done in bootstrap)
And also remove the '?>' from the last line to make sure the problem isn't caused by a trailing whitespace.

What book is it that you are reading?
A good practice, since ZF is so new and still undergoing a lot of changes, would be to cross-reference everything you read with the online docs.
Chances are that whatever is printed in that book is outdated. The same goes for most tutorials that can be found online.
actually the book is from december 2007, i even had to update my own istallations to be compliant with the book
The book is: Practical Web 2.0 Applications with PHP ( Practical Web 2.0 Applications with PHP, by Quentin Zervaas (ISBN 1590599063) )

to confirm what you are asking about the registry-db thingy see code below.

when i get home i will look if i have a trailing ?> or not, and if it makes the difference.

bootstrap: (line 21/22)
PHP Code:
<?php
    
require_once('Zend/Loader.php');
    
Zend_Loader::registerAutoload();

    
// load the application configuration
    
$config = new Zend_Config_Ini('../settings.ini''development');
    
Zend_Registry::set('config'$config);


    
// create the application logger
    
$logger = new Zend_Log(new Zend_Log_Writer_Stream($config->logging->file));
    
Zend_Registry::set('logger'$logger);


    
// connect to the database
    
$params = array('host'     => $config->database->hostname,
                    
'username' => $config->database->username,
                    
'password' => $config->database->password,
                    
'dbname'   => $config->database->database);

    
$db Zend_Db::factory($config->database->type$params);
    
Zend_Registry::set('db'$db);


    
// setup application authentication
 
<snip>

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 02-08-2008, 12:13 PM
Junior Member
 
Join Date: Feb 2008
Posts: 3
Default

the only thing i was thinking about is that the book uses ZF 1.02 and i have ZF 1.03 installed.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 02-09-2008, 11:04 PM
Senior Member
 
Join Date: Jan 2008
Location: chicago
Posts: 100
Default

Quote:
Originally Posted by shibuya View Post
Yes I have. It's inside the controller directory.
No, the view scripts should be in the VIEWS directory
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #19 (permalink)  
Old 02-14-2008, 07:43 PM
Junior Member
 
Join Date: Feb 2008
Posts: 1
Smile solution to the problem

Hello,

This example comes from the Web 2.0 Applications with PHP book,
I tried this and had the same problem,
the solution is simple,
just add:

$controller->setParam('noViewRenderer' , true);

after the ::getInstance();

and it works.
Don't ask me why,
I'm pretty new to this,
but the errors are gone,
at least in my case.

Hope it works for you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #20 (permalink)  
Old 04-05-2008, 02:01 AM
Ron Ron is offline
Junior Member
 
Join Date: Apr 2008
Posts: 7
Default Need to register your own ViewRenderer object

I went through the same issue. The example in the book is extending the framework to implement Smarty templates instead of using the Zend viewer. Search "Zend_Controller_Action_Helper_ViewRenderer" in the Zend Manual for more info. I had to stop with the book and do a few simpler tutorials that used the default views. The book made more sense once I had a general idea what I was extending.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:50 PM.