2009年6月8日星期一

Re: [fw-mvc] Best practice for default module directory

David Mintz-2 wrote:
>
> On Mon, Jun 8, 2009 at 9:08 AM, Matthew Weier O'Phinney
> <matthew@zend.com>wrote:
>
>> Actually, Zend_Tool now has module support (as of 1.8.2). When you
>> create a module, it places it in application/modules/<modulename>, and
>> creates the appropriate directory structure.
>
>

This needs some documentation because I ran through the tutorial
(http://framework.zend.com/docs/quickstart) I couldn't get it to make
modules at all :( (Win XP) no error message and no module? weird.


David Mintz-2 wrote:
>
> Woa -- run this by me again? I thought that if your app had modules, *all*
> your modules -- default included -- had to reside under a common
> directory,
> e.g., application/modules. I further thought that the way your directory
> structure ends up after you create a module with the tool was just a flaw
> in
> the tool. You're saying the default module's controllers etc can simply be
> in application/ while the foo module's files can be in
> application/modules/foo? Interesting!
>

I do this, I had controllers in an application. Then some of the controllers
got big so I made them into modules an put them in the /modules/ dir. ZF is
quite nice as you can 'promote' a controller into a module with little or no
URL changes. For example, say you have a controller called
'adminController.php' you can move the controller into

/modules/admin/controllers/indexController.php

then move the view scripts etc... then your URL http://site.com/admin/ still
works. Good SEO, and pretty easy really. Maybe 'admin' is a crap example. I
had to do this with my 'reports' controller we started with 4-5 and ended up
with over 100, so it made sense to move the reports into a module.

It's also cool that you can access an application model and a modules model
with $tmp = new ModuleName_Model_Table()... nice feature.

monk.e.boy

--
View this message in context: http://www.nabble.com/Best-practice-for-default-module-directory-tp23923311p23924999.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: