CodeIgniter Forums
how to properly structure controllers in HMVC - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: how to properly structure controllers in HMVC (/showthread.php?tid=65595)



how to properly structure controllers in HMVC - jaynarayan - 06-29-2016

HI ,
this is my first  project using hmvc. i am confused how to organize modules. my site have admin area , authenticated area and public area.
in mvc i  would do it this way
controllers
--admin
----------users
----------products
----------orders
--public
----------users
----------products
----------orders
--auth
----------users
----------products
----------orders

how to  organize things in hmvc?


RE: how to properly structure controllers in HMVC - InsiteFX - 06-29-2016

modules
-- admin
---- users
---- products
---- orders
-- public
---- users
---- products
---- orders
-- auth
---- users
---- products
---- orders


RE: how to properly structure controllers in HMVC - iridion2015 - 07-02-2016

Also remember

1 table equals 1 model
1 table equals 1 controller
You can create many views...

I learned these from David Conelly


RE: how to properly structure controllers in HMVC - jaynarayan - 07-05-2016

(06-29-2016, 05:53 PM)InsiteFX Wrote: modules
-- admin
---- users
---- products
---- orders
-- public
---- users
---- products
---- orders
-- auth
---- users
---- products
---- orders

what about models.?i have to create user model in all three modules?


RE: how to properly structure controllers in HMVC - InsiteFX - 07-06-2016

Controllers may be loaded from application/controllers sub-directories.

Controllers may also be loaded from module/controllers sub-directories.

--> Resources may be cross loaded between modules. ie: $this->load->model('module/model');

Modules::run() is designed for returning view partials, and it will return buffered output (a view) from a controller. The syntax for using modules::run is a URI style segmented string and unlimited variables.