I am using CodeIgniter, and in one of my models I would like to refer the $this
which is used in $this->load->model
and $this->load->view
, instead of the $this
which refers to the object itself.
Is it possible?
Thanks,
Lemiant
I am using CodeIgniter, and in one of my models I would like to refer the $this
which is used in $this->load->model
and $this->load->view
, instead of the $this
which refers to the object itself.
Is it possible?
Thanks,
Lemiant
You won't be able to use $this
to refer to anything but the model object itself, meaning you won't be able to do $this = ...
.
But you can get the controller instance using the following function:
$controller = &get_instance();
As aularon reminded though, if your application is designed such that you have to access your controller from a model, then perhaps you might want to rethink its implementation.