logo       

Re: Question about setControllerDirectory: msg#00102

php.zend.framework.mvc

Subject: Re: Question about setControllerDirectory

-- David G. <allenskd-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote
(on Friday, 18 July 2008, 02:47 PM -0700):
> Well, I wanted to separate the administration controllers from the main site
> logical code. This is my first time doing it and thought I would give it a
> try for the sake of not overcomplicating my life.
>
> Here's the code

<snip>

> $frontier->setControllerDirectory(
> array('ImageHost' => 'application/CMS/controllers',
> 'ImageHostAdmin' => 'application/CMSAdmin/controllers')
> );
>
> var_dump($frontier->getModuleControllerDirectoryName());
>
> $frontier->dispatch();
>
> ?>
>
>
> Can someone explain why ZF is throwing this message at me?
>
> Fatal error: Uncaught exception 'Zend_Controller_Exception' with message 'No
> default module defined for this application' in

Yep. You need a default module, so that ZF knows where to route
requests. Normally, this will be a directory that was specified without
a name, or one specified with the name 'default':

// implied as default:
$frontier->setControllerDirectory('application/CMS/controllers');

// explicitly default:
$frontier->setControllerDirectory('application/CMS/controllers', 'default');
// or:
$frontier->setControllerDirectory(array(
'default' => 'application/CMS/controllers'
));

However, you can also tell ZF which module should be considered the
default, by hinting this to the dispatcher:

$frontier->getDispatcher()->setDefaultModule('ImageHost');

By default, controllers in the default module are not prefixed with the
module name (i.e., 'FooController' and not 'ImageHost_FooController');
however you can hint to the dispatcher to use the module prefix if you'd
like:

$frontier->setParam('prefixDefaultModule', true);

Hope this information clears things up.

--
Matthew Weier O'Phinney
Software Architect | matthew-C1q0ot2/XZ0@xxxxxxxxxxxxxxxx
Zend Framework | http://framework.zend.com/



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise