Welcome Guest, Not a member yet? Register   Sign In
Accessing MY_Moldel methods in MY_Controller
#1

[eluser]pepys[/eluser]
Hi,

How can I access a MY_Moldel method inside of MY_Controller?

Thanks.
#2

[eluser]Ewout[/eluser]
Use the Loader class.
#3

[eluser]pepys[/eluser]
thanks for answer. isn't the MY_Model model automatically loaded? i think it is, but i don't know how to address a MY_Model method inside of MY_Controller. how can i load manually the MY_Model model? it doesn't work with $this_>load->model('my_model'), normal, the MY_Model is kept on /core and not on /controllers..

any other help? thanks
#4

[eluser]Ewout[/eluser]
A model isn't auto-loaded normally, except if you say so in the autoload.php config file.
Using $this->load->model should work and then use $this->my_modal->function to use.

Is your model in the models folder?
#5

[eluser]pepys[/eluser]
MY_Model extends CI_Model and all my other models extends MY_Model, not CI_Model.

MY_Model is in the /core folder, not in /models folder.

I need to access methods from that MY_Model inside of the MY_Controller controller.

MY_Controller controller CI_Controller and all my other controllers extends MY_Controller.

Still need help..
#6

[eluser]zarcel[/eluser]
You can call those methods using your model class since it inherits all methods from MY_Model.




Theme © iAndrew 2016 - Forum software by © MyBB