Welcome Guest, Not a member yet? Register   Sign In
Model can’t load or use libraries or other models from the constructor
#4

[eluser]Colin Williams[/eluser]
It is very expected. Two distinct steps.

A. Model is instantiated (this is when the constructor runs)
B. References are copied from the controller to the instantiated model.

Quote:So I can’t load anything from the model

You can, but you have to use the controller to do it.

Code:
$ci =& get_instance();
$ci->load->library('email');
$ci->email->send();

Don't worry, this seems to be confusing to most new CI users, especially those new to OOP


Messages In This Thread
Model can’t load or use libraries or other models from the constructor - by El Forum - 01-10-2010, 01:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB