2008年12月3日星期三

Re: [fw-mvc] Controller class naming when using modules

Thanks, Matt!  That worked.  I'm back on the boat now! ;-)

Matthew Weier O'Phinney wrote:
-- Jim Mullen <jim@idimensionz.com> wrote (on Monday, 01 December 2008, 04:17 PM -0500):   
Environment: ZF 1.7.0  I have a directory structure like: /application    /modules        /default        /foo            /controllers                Foo_FooController.php  My module and controller name are the same (foo) so I wind up with a URL   like mysite.com/foo/foo/list where list is the action.  However, I'm getting an exception saying "Invalid Controller Specified   (foo)".  My class name in Foo_FooController.php is FooController.  I   also tried Foo_FooController and got the same error.  What do I need to   name my controller class for ZF dispatcher to recognize it?     
 You're missing the boat here. :)      modules/         foo/             controllers/                 IndexController.php -- class Foo_IndexController                 FooController.php   -- class Foo_FooController                 BarController.php   -- class Foo_BarController  Basically, the module name becomes a prefix -- in this case, 'foo' becomes prefix 'Foo_', and then then controller class name is appended to it.    

没有评论: