On the topic of best practices for modular layout, what would you suggest for this use case. I have a modular project where the default module would be the front end of the site, and then other modules located in a subdirectory. However, one specific module, "admin", is one that I may want to serve on a separate subdomain from the rest of the project.
I've done this in the past by leaving out the prefix Namespace of the "admin" controller and creating a separate bootstrap which sets that module directory as the default controller. Obviously, this isn't truly flexible as if I decide I want to serve it from primary domain, I would have to go in and add the Admin_ prefix to all the controllers. Is there a better way to accomplish this task?
On Mon, Jun 8, 2009 at 10:22 AM, Matthew Weier O'Phinney <matthew@zend.com> wrote:
-- David Mintz <vtbludgeon@gmail.com> wrote
(on Monday, 08 June 2009, 09:45 AM -0400):
>This has been the design all along, actually. :)
>
> 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.
>
> The default module is assumed to be directly under application/, and
> this is how Zend_Tool was written. The idea is that your default module
> is typically non-reusable, and very site-specific, and as such falls
> outside of your other modules (which should typically be re-usable).
>
> 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!
The addModuleDirectory() method is simply a convenience method when you
have a number of modules under a common directory. You can achieve
similar functionality using setControllerDirectory() and passing an
array argument of moduleName => controller directory pairs -- which
allows you to have a completely custom directory layout if you so
desire.
Zend_Tool simply codifies what we've been trying (unsuccesfully, it
appears) to promote since adding module support in the 0.6 release.
--
没有评论:
发表评论