-
Notifications
You must be signed in to change notification settings - Fork 0
Modular Separation
[b]Current version:[/b] File:Modular_Separation_2.1.zip [b]Forum Thread:[/b] [url]http://codeigniter.com/forums/viewthread/46669/[/url] [b]Last update:[/b] 27-09-2007
This is a solution for people that are looking for a way to keep associated models, views, controllers and other resources in the same directory and thereby making their application more modular.
[h2]Installation[/h2] First of all you should go ahead and grab yourself a copy of the File:Modular_Separation_2.2.zip.
When you are done grabbing, you should place both files in your [i]/application/libraries/[/i] folder.
Finally, you must create the directory [i]/modules/[/i] in your [i]/application/[/i] folder.
And that's it! sound of party blowers
[h3]... Unless you are running PHP 4[/h3] In which case you will have to use File:Modular_Separation_PHP4.zip. Download it and overwrite the original in your [i]/codeigniter/[/i] folder.
[h2]Folder structure[/h2] I would like to start with pointing out that you are still able to use models, views, controllers and other resources as usual when using Modular Separation. This also means that you can have global resources in your standard folders and call them from your modules. If you, on the other hand, want to get rid of the folders then you are free to do so, [b]with the exception of the controllers folder[/b].
Modules must be placed in the /application/modules/ folder. A module is a folder (the foldername is the name of the module) containing folders for models, views, controllers and other resources. These are not required and you do not have to add folders for e.g. models if you are not including any models in the module.
Just to make sure we are clear on the folderstructure, he is an example: [code] system application modules account controllers account.php libraries my_generic_authlib.php models user_model.php views login.php register.php news controllers news.php models news_model.php views list.php categories.php [/code]
[h2]Usage[/h2] Now, all you have to do in order to load a resource from the current module, is add its name as the last argument of one of the loader methods. But since most of those have additional arguments that are not commonly used, I have also made special module-methods where the name of the module is the first argument. Here is a full list of methods and their arguments:
[h3]library($library = '', $params = null, $module = '')[/h3]