|
Re: Question about setControllerDirectory: msg#00103php.zend.framework.mvc
Hello Matthew, thanks for answering. I think I might have jumped the gun a bit for not reading the manual that is, although there isn't much covered about modules and the routers itself, or maybe I'm complicating myself a bit thinking it's complex. I'm still snooping around and have begun to understand how it works, yet I'm not receiving the results as one would expect. My current structure is application - default - controllers - views - administrator - controllers - views library - Zend index.php .htaccess Now, from what I gather ZF determines the module http://mysite.com/MODULE/Controller/action/ and also http://mysite.com/controller/action I don't know why, but if I use http://mysite.com/IMAdmin/home it will display the index.phtml ImageHost uses for some reason. I also tried turning on the prefixes, then it asked me for Default_IndexController which I created in the controllers directory and changed the object's name and it kept asking for it. I modified the code $frontier->setControllerDirectory( array( 'default' => 'application/ImageHost/controllers', 'administrator' => 'application/IMAdmin/controllers') ); Right, I'm assuming http://mysite.com/ImageHost/index will call the module in there and index controller. It does, but when I go to the IMAdmin, it calls the same thing, even if I modified the index.phtml. Well, I guess there is a lot of reading to do. I wonder, if I use modules, then I won't be able to take advantage of Zend_Controller_Router_Route_Regex and so on? Thanks, David Matthew Weier O'Phinney-3 wrote: > > -- 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/ > > -- View this message in context: http://www.nabble.com/Question-about-setControllerDirectory-tp18538214p18540870.html Sent from the Zend MVC mailing list archive at Nabble.com. |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Question about setControllerDirectory: 00103, Matthew Weier O'Phinney |
|---|---|
| Next by Date: | Re: Best practices in a thin-controller application: 00103, Adam Jensen |
| Previous by Thread: | Re: Question about setControllerDirectoryi: 00103, Matthew Weier O'Phinney |
| Next by Thread: | Re: Question about setControllerDirectory: 00103, David G. |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |