2009年6月8日星期一

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

Using the module bootstrap from  Zend_Application for your modules ensures that the models for every module are accessible automatically.

Only for the default module you need to add some code to load them. I can look it up and send it to you later if you're interested.

With kind regards,

Jeroen Keppens
http://blog.keppens.biz

On 8-jun-09, at 17:53, Paul Court <paul@pmcnetworks.co.uk> wrote:

What I sometimes find confusing, is that I will often want to use models from one module in another. So I am not so bothered if the default module is app/... or app/modules/... as long as I have app/Models/xyz that I can call from both.

A good use-case for this would be a very average website that has users that login (app/models/User.php?). Obviously this needs to be accessible by the main front end, but also the "admin" module is going to want to be able to use those models too.

-- Matthew Weier O'Phinney Wrote
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).

I am not too sure how much *module* code would be reusable. I think all the controller code I have written thus far has been site/app specific - whether it be front end default stuff or back end admin type tasks. Do you have any use-case examples that could clarify this?

I thought the best idea for reusable code would be to make your own ../library/MyPrefix/... somewhere on the include path?

--
Paul 
(aka. Gargoyle)

没有评论: