|
|||
|
I'm having a problem with my bootstrap file telling me that it cant load any controllers.
My directory layout is this (it is the default layout): Code:
application/
applets/
controllers/
AppletsController.php
models/
views/
default/
controllers/
IndexController.php
UserController.php
models/
views/
news/
controllers/
models/
views/
tasks/
controllers/
TasksController.php
models/
views/
html/
images/
scripts/
styles/
index.php (BOOTSTRAP FILE)
Code:
<?php
/**
* Real Estate Manager
*
* @author
* @version
*/
date_default_timezone_set("Australia/Hobart");
set_include_path('.' . PATH_SEPARATOR . '..' . PATH_SEPARATOR . '../library' . PATH_SEPARATOR .
'../application/default/models/' . PATH_SEPARATOR . get_include_path());
include "Zend/Loader.php";
/**
* Load needed Classes
*/
Zend_Loader::loadClass('Zend_Controller_Front');
Zend_Loader::loadClass('Zend_View');
Zend_Loader::loadClass('Zend_Db');
Zend_Loader::loadClass('Zend_Debug');
Zend_Loader::loadClass('Zend_Log');
Zend_Loader::loadClass('Zend_Log_Writer_Db');
Zend_Loader::loadClass('Zend_Config');
Zend_Loader::loadClass('Zend_Session');
Zend_Loader::loadClass('Zend_Config_Ini');
Zend_Loader::loadClass('Zend_Registry');
// Auto Load any instanciated classes
Zend_Loader::registerAutoload();
/**
* Load the Configuration INI file
*/
$config = new Zend_Config_Ini('../application/config.ini');
$registry = Zend_Registry::getInstance();
$registry->set('config', $config);
$config = Zend_Registry::get('config');
/**
* Initialise a Database connection
*/
$DB = Zend_Db::factory($config->database->db->adapter, $config->database->db->config->toArray());
Zend_Registry::set('DB', $DB);
/**
* Set up the Logging System and put it in the Registry
*/
$columnMapping = array('priority' => 'priority', 'message' => 'message',
'timestamp' => 'timestamp', 'username' => 'user',
'address' => 'address');
$writer = new Zend_Log_Writer_Db($DB, 'log', $columnMapping);
$logger = new Zend_Log();
$logger->addWriter($writer);
$logger->setEventItem('address', $_SERVER['REMOTE_ADDR']);
Zend_Registry::set('logger', $logger);
/**
* Setup controller
*/
$controller = Zend_Controller_Front::getInstance();
$controller->throwExceptions(true); // should be turned on in development time
$controller->setControllerDirectory('../application/default/controllers');
$controller->addControllerDirectory('../application/news/controllers', 'news');
$controller->addControllerDirectory('../application/applets/controllers', 'applets');
$controller->addControllerDirectory('../application/tasks/controllers', 'tasks');
/**
* Start a new Zend Session
*/
Zend_Session::start();
// run!
$controller->dispatch();
Browsing to the url of the site works fine (brings up IndexController ->default action). Even using the UserController works fine (http://url/user/action). But, when I try to use one of the module controllers (http://url/tasks/action) (which should be loaded in the bootstrap file) I get the following error: Code:
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (index)' in library/Zend/Controller/Dispatcher/Standard.php:198 Stack trace: #0 library/Zend/Controller/Front.php(929): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 html/index.php(82): Zend_Controller_Front->dispatch() #2 {main} thrown in library/Zend/Controller/Dispatcher/Standard.php on line 198
Can anyone help me on this? |
|
|||
|
7.11.2. Specifying Module Controller Directories
Zend Framework: Documentation |
![]() |
| Thread Tools | |
| Display Modes | |
|
|