Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic

codeigniter and hmvc questions

codeigniter and hmvc questions  using -'codeigniter,themes,frontend,backend,hmvc'

First of all, sorry for any convenience caused by this post because this is the first time I post a question here and I need more time to get used to with this.

Q1. I want to create 2 "master controllers" for FrontEnd and BackEnd like this:

MY_Controller extends CI_Controller
FrontEnd extends MY_Controller and all frontend controllers will extend FrontEnd.
BackEnd extends MY_Controller and all backend controllers will extend BackEnd.

What's the best way to do that with HMVC (MX)?

Thanks @Wesley Murch for giving the idea to put 3 classes MY_Controller, Frontend, Backend into MY_Controller.php but I think putting each class in one php file is better (cleaner). Or am I wrong? I was thinking of creating a structure like this:

./core/MY_Controller.php (extends MX_Controller)
./libraries/Backend.php (extends MY_Controller)
./libraries/Frontend.php (extends MY_Controller)
Auto load Backend and Frontend in autoload.php
All frontend controllers will extend Frontend (E.g: class Blog extends Frontend)
All backend controllers will extend Backend (E.g: class Admin extends Backend)

Will that work without putting one more line of code in backend/frontend controllers to include_once or require_once: ./libraries/Backend.php or ./libraries/Backend.php?

Q2. How to implement multiple themes with HMVC?
For example, in MVC, we can have 2 themes strutured like this:


But in HMVC, views folders are inside separated folders and if I want to implement multiple themes, normally I have to do like this:


That's not what I want because I want to put all views file of a theme into only one folder and later, if I want to create a new theme, I will need to duplicate one theme folder only. But I am wondering how I can do that without breaking HMVC models (because as far as I know, in HMVC model, Models, Views, Controllers must be in one module folder - at least with CI). That is the conflict I am getting stuck at.

asked Sep 15, 2015 by CharaKDAoqhe
0 votes

Related Hot Questions

Walkin Jobs Opening

Government Jobs Opening