10-06-2012, 03:36 AM
[eluser]zoreli[/eluser]
I would like to know...can I load the model in my constructor function instead of loading it for each function within that controller?
Lets say that I have 5 functions that use same model. Instad of loadin the same model in all 5 functions, should I load the controller in the construcor function like this?
Is this good practice or no??
I would like to know...can I load the model in my constructor function instead of loading it for each function within that controller?
Lets say that I have 5 functions that use same model. Instad of loadin the same model in all 5 functions, should I load the controller in the construcor function like this?
Code:
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class BackOfficeUsers extends MY_Controller
{
// constructor function
public function __construct()
{
parent::__construct();
$this->load->model('backOfficeUsersModel'); // load it here??
} // end of constructor function
Is this good practice or no??