1

I have an App in CodeIgniter built using the regular MVC pattern. If I want to switch to HMVC then I have to move all Models,Views and Controllers to the modules folder? I don't understand if in HMVC everything is a module or both Modules and the old MVC structure can coexist.

tereško
  • 58,060
  • 25
  • 98
  • 150
enbits
  • 66
  • 6

1 Answers1

2

H in HMVC stands for hierarchical, the files in your normal controllers,vews and models folders are on top of the hierarchy. This means that you can still use or old controllers,models,views folders. These folders will then be accessible by all modules in your system.

jonixj
  • 397
  • 3
  • 11
  • Thanks jonixj!. So If I have a Blog Controller inside Application/Controllers and also a Blog Module inside Application/Modules which one will be executed? – enbits Mar 13 '13 at 22:57
  • 1
    If you have a file controllers/blog.php and a file modules/blog/controllers/blog.php the latter will be executed if you browse index.php/blog – jonixj Mar 13 '13 at 23:03
  • i am unable to use redirect function from module controller that points to the main controller. i could not find anybody talking about this. do you know if you can do that? – Thupten Sep 12 '13 at 00:38
  • HMVC for CI 3 has a bug requires this fix: https://stackoverflow.com/questions/41557760/codeigniter-hmvc-object-to-array-error – devXen Mar 13 '18 at 13:19