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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You won’t be able to use
$thisto 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:
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.