Code: Select all
class IndexController extends Zend_Controller_Action{
public function indexAction()
{
//exit;
//return;
$this->response->setBody('Output from the action');
}
}Why is this happening, what am I missing in understanding how Zend controllers work?Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in C:\wamp\www\admin\core\libraries\Zend\Controller\Dispatcher\Standard.php:242
Stack trace:
#0 C:\wamp\www\admin\core\libraries\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 C:\wamp\www\admin\index.php(24): Zend_Controller_Front->dispatch()
#2 {main}
thrown in C:\wamp\www\admin\core\libraries\Zend\Controller\Dispatcher\Standard.php on line 242
EDIT | Why would an exception be thrown?? I don't get it I echo'ed $controller from within Dispatcher:
Code: Select all
if (!$this->getParam('useDefaultControllerAlways') && !empty($controller)) {
echo $controller;
require_once 'Zend/Controller/Dispatcher/Exception.php';
throw new Zend_Controller_Dispatcher_Exception('Invalid controller specified (' . $request->getControllerName() . ')');
}Code: Select all
$front = Zend_Controller_Front::getInstance();
$front->registerPlugin(new Zecko_Controller_Plugin_CheckAuth());
$front->registerPlugin(new Zecko_Controller_Plugin_NoCache());
$front->setParam('noErrorHandler', true);
//$front->setParam('noViewRenderer', true);
//$front->setParam('useDefaultControllerAlways', true);
//$front->setDefaultControllerName('Index');
$front->setDefaultAction('index');
$front->setDefaultModule('domain');
$front->setModuleControllerDirectoryName('controllers');
$front->addModuleDirectory('../../module/system');
$front->dispatch();
domain/index/test
domain/index/index
So long as I 'exit' at the end of the actions they output as expected, otherwise Zend s***'s all over me??? Obviously the dispatcher/router/whatever is capable of finding the controller:action as the methods are invoked and only fail in the case exit isn't used with the method.
Cheers,
Alex