I’ve been playing around with HMVC for a little while now, but I’m trying to do something now that’s pushing rather hard on the boundaries of my PHP knowledge.. So, here’s me hoping someone here could help point me in the right direction or give me a few tips. 😊
For the moment all I’m looking at is the loading of views. Currently, this HMVC extension checks for the requested view in the ‘application/[current_module]/views’ first, then the default ‘application/views’ folder if the first is false. In my little pet project, I would like to insert my own ‘view’ folder location check just before the HMVC one.
Working with the following folder structure:
/* -------------------------------------
- application
- modules
- module_a
- controllers
- module_a.php
- module_b
- controllers
- module_b.php
- views
- module_b.php
- module_c
- views
- module_a.php
- module_c.php
------------------------------------- */
If I do something like this:
class Module_a extends MX_Controller {
public function index() {
$this->load->view('module_a');
}
}
I would like to check the ‘module_c’ views folder first for a match, then the current module (module_a) if the first check is false. Just to add another interesting twist, I’ve already completely removed the default ‘application/views’ folder, since it’s not going to be used for this project. 😊
Would I need to edit the ‘public function view()’ function in ‘third_party/MX/Loader.php’, or could I perhaps do this outside of that file?