Welcome Guest, Not a member yet? Register   Sign In
CI classes + custom library
#1

[eluser]rvent[/eluser]
Hello,

I've read the docs, but got a quick question about CI classes.

In the docs it mentions that to be able to use them you need to do:
Code:
$CI =& get_instance();
$CI->load->helper(array('form', 'url', 'array'));
$CI->load->model('m_version');

so in order to load up my model i would have to do that in every function i need them...? Or could i just put it in a constructor..?
Code:
function _Class()
{
$CI =& get_instance();
$CI->load->helper(array('form', 'url', 'array'));
$CI->load->model('m_version');
}

And technically access the model with $this->MyModel->something()...?

am i correct and way off..?

Thanks
#2

[eluser]rvent[/eluser]
It would be:
$this->CI->MyModel->something().




Theme © iAndrew 2016 - Forum software by © MyBB