Iain
Iain

Reputation: 625

How to get modules to work in the Zend Framework

I'm getting the following error when trying to use a modular layout in my Zend Framework application:

Undefined index: authentication in C:\PHP\includes\Zend\Controller\Dispatcher\Standard.php on line 385

The following code runs before this error:

if (!$this->_acl->isAllowed($role, $resource, $privilege)) {
    $request->setModuleName('authentication');
    $request->setControllerName('auth');
    $request->setActionName('login');
    $request->setDispatched(false);
}

in my bootstrap, I have:

$frontController
    ->setParam('environment', $this->environment)
    ->setControllerDirectory(ROOT_DIR . '/controllers')
    ->addModuleDirectory(ROOT_DIR . '/modules');

and my directory structure is:

/ application
    / controllers
    / models
    / views
    / library
    / modules
        / Authentication
            / controllers
                AuthController.php

Any thoughts why that's not working?

Upvotes: 0

Views: 1443

Answers (2)

rg88
rg88

Reputation: 20977

Out of curiosity, why do you have an entire module set up for authentication (as opposed to just having an action inside the default module take care of this)?

Upvotes: 0

Peter Bailey
Peter Bailey

Reputation: 105868

Case sensitivity? There's nothing I found in the docs that specifically mentions case sensitivity, but all the examples with modules also show module directory names that are all lowercase.

My own, recent ZF app uses modules and the directory names are all lowercase.

Also, do you have a default module set in your route definitions?

Upvotes: 1

Related Questions