codeigniter hmvc and main controllers,models and views

396 views Asked by At

I decided to try HMVC pattern with codeigniter but I have some doubts about how to think about and build my website structure using this pattern so I have some questions:

  1. if the main focus is on modules what is the purpose of application/controllers, application/views and application/models.
  2. can I remove the aboved folders and route the default controller to some module?
  3. if I have 3 controller each of them haveing unique $type and $id but all of them need to call a controller that control every thing about comments in website and just pass $type and $id, will this confilct with HMVC pattern?
1

There are 1 answers

3
David On BEST ANSWER
  1. the purpose of this 3 folders is to have the most 'generic' things on your application. For example, if you have a crud model, you should have on the main model folder, outside your modules. Other example, if you have a generic header/footer view you should have it in the main views folder, and so on.
  2. You shouldn't remove this folders, but you can set the default controller just adding the module in front.
  3. I think this is not a problem, it will not be any conflict on hvmc pattern

here you have a good guide