Skip to content
World Wide Web Server edited this page Jul 4, 2012 · 85 revisions

[h3]Description[/h3] Modular Separation allows you to use modules for code organization in your application while only using a single controller per request. Instead of placing all of your controllers, models and views in the same folders you can have a "module" for each section of your site then place the MVC elements in there. This is known as HMVC (Hierarchical MVC).

You should be able to take any CodeIgniter application and place it into a module and it should work without alteration. However routes might need altering to allow for the added separation of a module.

[h3]Features[/h3]

All module controllers are accessible from the URL via module/controller/method or simply module/method if the module and controller names match.

If you add the _remap() method to your controllers you can prevent unwanted access to them and redirect or flag an error as you like.

[h3]Module Directory Structure[/h3] Image:hmvc_structure.gif

[h3]But that sounds like...[/h3]

Do not confuse Modular Separation with Modular Extensions (HMVC). ME is an older system that maintains support for PHP 4 and allows controllers to be called between each other. Modular Separation drops PHP 4 support and adds many awesome new features not available in ME.

Modular Separation works the same way as Zach’s Matchbox, But is much faster in execution and does the job without using additional module_xxxx() calls. The main reason for the speed improvement is lots of clever PHP 5-only syntax is used, while Matchbox supports PHP 4 too.

[h3]Download[/h3]

[url=http://codeigniter.com/?ACT=51&fid=58&aid=10003_6avIWaB8yxJCM37u2pnH&board_id=2]Download v1.11[/url]

[i]Phil Sturgeon has patched v1.11 to work with CodeIgniter 2.0 and called it [url=http://github.com/philsturgeon/codeigniter-modular-separation]Modular Separation 2.0[/url] for naming consistency.[/i]

[h3]Discuss[/h3]

[url=http://codeigniter.com/forums/viewthread/121820]Forum thread[/url]

wiredesignz

Clone this wiki locally