
Originally Posted by
phpimpact
Remember that a modular architecture it's not just moving files and directories around, it doesn't work like that. In your case, it will help if you have a global/ directory where you put your shared templates and files. If for some crazy reason you want to use a template located in another module, you can do $this->getView('example.html', 'module_name'). But, just like I said before, try to reduce intermodule dependencies, a module that loads templates from other modules, is more difficult to maintain.
Dependencies on items in other modules/components is one area I ran into pretty quickly with the complex application I am currently creating. I ended up having to create an additional parameter to many of the common functions to specify the module the item was in. If there was none given (defaults to NULL), the module is determined by naming conventions, or the current module in use is assumed. I also have a set of common directories in a specific subfolder that store things like the global page layouts, common images available to all modules, etc.
My setup seems to work very similar to yours, phpimpact - I use:
PHP Code:
// To get a specific controller
$this->locator->getController('News'); // Automatically looks in 'news' module (naming convention)
// To get a specific model
$this->locator->getModel('Users'); // Automatically looks in 'users' module (naming convention)
// To get a common library class
$this->locator->get('FileUpload'); // Automatically looks in global library
And then all of these functions have the optional second parameter to specify the module/component if you need to be more specific:
PHP Code:
$this->locator->get('BetterFileUpload', 'files'); // Looks in 'files' module library folder
// Override naming conventions by using second optional parameter
$this->locator->getModel('Users', 'customers'); // Looks in 'customers' module (overriding naming convention or looking in 'users' module)
Bookmarks