0
votes

I have created a module called Admin and created a controller Admin through zend tool. and added follwoing code in the bootstrap

protected function _initAutoLoad ()
{
    $front = Zend_Controller_Front::getInstance();
    $front->setControllerDirectory(array(
                            'default' => APPLICATION_PATH . '/default/controllers' ,
                            'Admin'   => APPLICATION_PATH . '/Admin/controllers'
                                  ));
    $autoloader = Zend_Loader_Autoloader::getInstance();
    $autoloader->suppressNotFoundWarnings(false);
}

But if I am accessing http://localhost/zf_hemr/Admin url I am getting "Not Found" error. if I am accessing "http://localhost/zf_hemr/public/Admin" url I am getting following error:

Page not found
Exception information:

Message: Invalid controller specified (index)
Stack trace:

#0 D:\web\www\zf_hemr\library\Zend\Controller\Front.php(954):     Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),     Object(Zend_Controller_Response_Http))
#1 D:\web\www\zf_hemr\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#2 D:\web\www\zf_hemr\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#3 D:\web\www\zf_hemr\public\index.php(26): Zend_Application->run()
#4 {main}  

Request Parameters:

array (
  'module' => 'Admin',
  'controller' => 'index',
  'action' => 'index',
)  

Can you please let me know where I went wrong?

1
Could you please add your project directory structure ?Liyali
sure. skydrive.live.com/… please see the above url to view the structure.Pradeep

1 Answers

0
votes

You probably forgot to add /modulesto your paths:

$front->setControllerDirectory(array(
                              'default' => APPLICATION_PATH . '/modules/default/controllers',
                              'Admin'   => APPLICATION_PATH . '/modules/Admin/controllers'
                              ));

However, you shouldn't have to do this, the right way to do it to me is to add these lines in your configuration.ini file:

resources.modules[] =
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.prefixDefaultModule = false

The first line enables the resource plugin Zend_Application_Resource_Modules that is going to take care of everything for you.