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


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-14-2008, 02:22 AM
Junior Member
 
Join Date: May 2007
Posts: 9
Unhappy URGENT - Controller wont load?

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)
And here is my 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
I have no idea why it is telling me that 'index' is an invalid controller. I'm not even requesting that controller!!!

Can anyone help me on this?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-19-2008, 07:43 PM
Senior Member
 
Join Date: Jan 2008
Location: chicago
Posts: 101
Default

7.11.2. Specifying Module Controller Directories
Zend Framework: Documentation
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 12:12 PM.