CodeIgniter Forums
Hierarchal MVC - Which One? - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived General Discussion (
+--- Thread: Hierarchal MVC - Which One? (/thread-37759.html)

Hierarchal MVC - Which One? - El Forum - 01-19-2011

I'm not new to the whole MVC approach, however I am to the Hierarchal MVC approach. I know the rest of the post may seem vague, but I'll try to describe it the best I can. I see on this forum people talking about Hierarchal MVC and the two systems that have been developed for CodeIgniter. My question for is:

Which one is better to use for someone used to CodeIgniter, but has never tried an HMVC approach?

The reasons why I believe I need a Hierarchal MVC is because I am currently developing a text-based RPG which needs modules for plugins, but also for an admin panel that will be sharing alot in common with the internal public side of the site.

Hierarchal MVC - Which One? - El Forum - 01-19-2011

You can develop any kind of system with MVC.
In 2.0 third party has been added, with a bit of logic programming you can do anything.

I'm working now to a very big hosting app, and i choose MVC not HMVC.

Hierarchal MVC - Which One? - El Forum - 01-19-2011

The reason why I am leaning more towards the HMVC style, is also down to wanting a clean and clear file system.

Hierarchal MVC - Which One? - El Forum - 01-19-2011

My file system is like this:

-> app
-> config (database,config)
-> models (general models)
-> third_party
-> automation
-> gateways
-> antifraud
-> geoip
-> CustomModules
-> library (Front controller)

// Every app (admin,cp,store) have his own Controller that extends Front

-> admin
-> controllers
-> folder/controller
-> folder/subfolder/controller/
-> folder/subfolder/anothersub/controller

-> cp
-> order
-> api
-> sapi
-> ajax
-> cron

is more big like that, but i show you how i go.

I consider it pretty elegant.

Hierarchal MVC - Which One? - El Forum - 01-19-2011

[eluser]Phil Sturgeon[/eluser]
Don't confuse HMVC with modular MVC. I was confused between the two for a long time, but basically HMVC beans "controllers calling other controllers" and modular MVC offers "normal MVC split between module folders".

Modular Extensions by wiredesignz offers both

Hierarchal MVC - Which One? - El Forum - 01-19-2011

Be aware that Sturgeons fork of Modular Extensions is out of date. Check my signature for a link to the latest version.

Hierarchal MVC - Which One? - El Forum - 01-19-2011

Ahh, well I've set up yours a while ago but it took me a while to realise that I needed to extend the MX_Controller from the core folder!

All that I got to do now is a few tests to see if I can work with HMVC and if it is suitable for the project. The only thing missing now is pre-built open-source modules!

Hierarchal MVC - Which One? - El Forum - 01-20-2011

[eluser]Phil Sturgeon[/eluser]
Oops, I didn't mean to link to my fork. That's what happens when you grab a link from the AwesomeBar at 2 in the morning!

You only need to extend MX_Controller if you want to use the HMVC feature. Modules will work either way.