aid

Wednesday, 15 April 2015

Loading a Model in MVC

Loading a Model in MVC
Your models will naturally to be loaded by controller functions. For load model you can use below sysntex:
$this->load->model('your Model_name');

Your model should be located in a application/model/modelname.php in folder, include the relative path from your models folder. For example, if you have a model located atapplication/models/modelname.php you'll load it using:
$this->load->model(mymodel');
Once your model is loaded, then you will able to access model functions from the hel of  an object of model class:

$this->load->model('Model_name');

$this->
Model_name->function();

No comments:

Post a Comment