Question

I new with hmvc and I want to ask about folder structure in codeigniter with hmvc extension. I used to arrange application controller folder for admin and public like this:

Application

--Controllers/

----admin/

------login.php

------dashboard.php

----blog.php

----about.php

----contact.php

So that page could be access with {base_url}/admin/login, {base_url}/admin/dashboard for Admin and for Public is {base_url}/blog , {base_url}/about etc.

With hmvc extension, how to achive url like that? for now i make my filename with admin_something.php, but that is look messy for me.

Application/

--Modules/

----admin_dashboard/

------Controllers/

--------admin_dashboard.php

------Models/

------Views/

----home/

------Controllers/

--------home.php

------Models/

------Views/

Thank you

Was it helpful?

Solution

You can have multiple controllers in your module. So make a folder admin with admin controller in your module's controller folder.

mymodule
- controller
  - home.php
  - admin/admin_dashboard.php
- model
  - model.php
- view
  - home_view.php
  - admin/admin_view.php

To access the modules

echo Modules::run('mymodule/home/methodname');

echo Modules::run('mymodule/admin/admin_dashboard/methodname');

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top