HMVC and Views in folders (Codeigniter) HMVC and Views in folders (Codeigniter) codeigniter codeigniter

HMVC and Views in folders (Codeigniter)


Assuming you're using Modular Extensions - HMVC:

If you have auth set up as a module already, you can just call:

$this->load->view('login_form', $data);

The file /views/login_form.php will be loaded from within the current module. This applies to models, language files, libraries etc. Think of the module as its own application, this is what you would normally do.

Additionally, to load a file from another module or a controller outside the module's directory, you can use $this->load->view('auth/login_form');

If the file is not found, it will check the other module paths including the default directory. This may or may not be the way other HMVC packages work, I'm not sure - but it's the way MX works.