[eluser]Unknown[/eluser]
First question from a CI->noob(). I am refactoring some code that uses a lot of helper functions. The original developer has placed SQL in here, which is rather disturbing.
Anyway, I wrote a model, and then from a controller, I loaded my model and stuck it in a global like so:
Code:
$this->load->model('Model_Name');
$GLOBALS['model_name'] = $this->Model_Name;
The helper can then call the model's methods like so:
Code:
$GLOBALS['model_name']->model_method($id);
This is better, but far from ideal.
So is there a better way of achieving same?