Welcome Guest, Not a member yet? Register   Sign In
Email Library Issues
#11

(This post was last modified: 01-06-2016, 09:35 AM by webdeveloper.)

check if u didnt replace CI email class with your value ... i saw in your code initialization function with $this->email = NULL ... if its so then error msg make sence ... in that case u calling from() function not on CI object but on NULL value which u replaced
EDIT: dont know why my first msg didnt apear after i post it so answered second time
Reply
#12

(01-06-2016, 09:33 AM)webdeveloper Wrote: check if u didnt replace CI email class with your value ... i saw in your code initialization function with $this->email = NULL ... if its so then error msg make sence ... in that case u calling from() function not on CI object but on NULL value which u replaced
EDIT: dont know why my first msg didnt apear after i post it so answered second time

My tried removing it, it didnt solve the issue, also my add_demo doesn't call on init
Reply
#13

Update so yes the class gets loaded but I just can't call on it at all without it giving me an error message.
Reply
#14

You have a form_validation rule which calls check_email() in the customers_model. The check_email() function not only loads the model in which it is defined (if you're lucky, this is a wasted call), then calls $this->customers_model->initialize() (which wipes out the email library, if it has been loaded, by setting $this->email = NULL), then proceeds to set $this->customers_model->email = $email, so you now have a string where the library previously would have been.

The only way you can access the email library from within the customers_model after doing all of that would be through get_instance()->email (or $ci = get_instance(); then using $ci->email->from() etc.). This is because the email library is normally made available to the model by way of the __get() magic method in CI_Model, but __get() won't be used if you've defined the property (which you've done by assigning it a value in both initialize() and check_email()).
Reply




Theme © iAndrew 2016 - Forum software by © MyBB