Welcome Guest, Not a member yet? Register   Sign In
HMVC best practices to reuse code
#2

[eluser]theprodigy[/eluser]
I haven't used ME, but I have used Matchbox, so I'll apologize now if my answer is not completely correct.

In Matchbox, it uses a hierarchical search. It first searches the current module directory for the resource you are asking for (controller, module, view, etc). If it can't find it there, it will then search the base (application level) directories. I'm not sure if there is another step, either between those two or afterwards, but it usually finds what I ask for at one of those levels.

According to ME's FAQ page, at the very bottom:
Quote:The model can be stored in the application folder (system/application/models/mymodelname.php) or in the models subdirectory of a module (system/application/modules/mymodule/models/mymodelname.php)

You may want to experiment to see if libraries and views are the same way. If so, then I would take your commonly used functions, and place them at the application level directories where they will be accessible by all your modules. This will make your modules less encapsulated, but I think any way you do it other then multiple copies will do the same.


Messages In This Thread
HMVC best practices to reuse code - by El Forum - 02-03-2010, 12:45 PM
HMVC best practices to reuse code - by El Forum - 02-03-2010, 07:42 PM
HMVC best practices to reuse code - by El Forum - 02-04-2010, 03:16 AM
HMVC best practices to reuse code - by El Forum - 02-04-2010, 04:37 PM
HMVC best practices to reuse code - by El Forum - 02-09-2010, 11:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB