Zend Framework 0.9.1 - Another problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Hades
Forum Commoner
Posts: 35
Joined: Mon May 08, 2006 4:49 pm

Zend Framework 0.9.1 - Another problem

Post by Hades »

Ok... give the amount of trouble I've been having getting the Zend Framework going I decided to go back to basics.

I have the bootstrap index.php and .htaccess files from the ZF manual and two controllers... IndexController and LoginController.

Each controller action has a simple echo statement that outputs the controller name and action name.

The Indexcontroller works fine, but LoginController gives the correct output along with the following error...

Code: Select all

Fatal error: Call to a member function isDispatched() on a non-object in /home/editpc/hubdata/library/Zend/Controller/Action.php on line 486
I've done a google search about this but only found vague references to it and no usable leads.

Any help would be appreciated.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Can you post your index.php and the controller's code. If it is long then provide a link were we can download it. It would be helpful to actually run the code to find the problem.
(#10850)
User avatar
Hades
Forum Commoner
Posts: 35
Joined: Mon May 08, 2006 4:49 pm

Post by Hades »

Sure... here you go...

Code: Select all

<?php
/**
 * Bootstrap file for HUB Application
 *
 * For ZF 0.9.1
 */

/*
 * The basics...
 */
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 1); //disable on production servers!
date_default_timezone_set('Europe/London');

set_include_path('/home/editpc/hubdata/library');

require_once 'Zend/Controller/Front.php';

$controller = Zend_Controller_Front::run('/home/editpc/hubdata/application/controllers');
?>

Code: Select all

<?php
/**
 * HUB Application IndexController
 *
 * This is the indexController for the HUB Application.  It will handle all
 * requests to the main index of the application.
 *
 * @category   HUB
 * @package	controller
 * @copyright  Copyright (c) 2007 Lee Conlin
 */

class IndexController extends Zend_Controller_Action
{

	public function IndexAction()
	{
		echo 'IndexController::IndexAction';
	}


}
?>

Code: Select all

<?php
/**
 * HUB Application LoginController
 *
 * This is the LoginController for the HUB Application.  It will handle all
 * login and user management.
 *
 * @category   HUB
 * @package	controller
 * @copyright  Copyright (c) 2007 Lee Conlin
 */

class LoginController extends Zend_Controller_Action
{

	public function IndexAction()
	{
		echo 'LoginController::IndexAction';
	}

	public function LoginController(){
		echo 'LoginController::LoginAction';
	}
}
?>
User avatar
AlexVN
Forum Newbie
Posts: 1
Joined: Mon Apr 02, 2007 3:12 am

Post by AlexVN »

The problem is here:

Code: Select all

class LoginController extends Zend_Controller_Action
{

        public function LoginController(){
                echo 'LoginController::LoginAction';
        }
}
Please rename LoginController method because it overwrites the default constructor.
User avatar
Hades
Forum Commoner
Posts: 35
Joined: Mon May 08, 2006 4:49 pm

Post by Hades »

Ok.. now I feel dumb. :oops:

That fixed it thanks. :)
Post Reply