I want to use The Modular Extensions HMVC in my Project like this:
modules
module01
models
models01.php
controllers
controller01.php
views
views01.php
module02
models
models01.php
controllers
controller01.php
views
views01.php
‘
‘
and i want use 'models01.php' from module01
, is there any way?
If you find that you need a particular model globally throughout your application, you can tell CodeIgniter to auto-load it during system initialization. This is done by opening the application/config/autoload. php file and adding the model to the autoload array.
Yes, but loading libraries where they're needed minimizes dependency issues.
What is Modular HMVC, why should I use it? A. Modular HMVC = Hierarchy of multiple MVC triads. Firstly, This is most useful when you need to load a view and its data within a view. Think about adding a shopping cart to a page.
In CodeIgniter Model are the PHP classes where all database related manipulation is done e.g. fetching records, insert, update, and delete records. Within this, all data processing logic is done. All model files are managed in application/models directory and they are load and access by the controller.
$this->load->model("module01/models01");
You can call any models from any module like this. Tested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With