Email library show me Fatal error: Call to a member function. [solved] |
[eluser]Ivan A. Zenteno[/eluser]
Hi to all. I'm trying do Contact module, this is my class contact: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); If I see method index() this view the html when I'm doing submit the form CI showme: Code: Fatal error: Call to a member function subject() on a non-object in application\controllers\contact.php on line 66 The line is $this->email->subject() I don't understand what happened. Best regards
[eluser]Aken[/eluser]
The error means that your email library is not loading. It likely means this line is not validating as TRUE: Code: if($this->data['smtp_enable'] == TRUE) Double check the info that your model function is returning to the variable $this->data, then go from there.
[eluser]nicholas.byfleet[/eluser]
Your problem could be that $this->data['smtp_enable'] is false, which would cause the email library not to be loaded. Try either loading the email library in the constructor, adding it to autoload.php or loading the library as the first line of your function. My guess is that $this->settings_model->get_conf(array('class'=>'core')); is returning false for 'smtp_enable'. Hope this helps...
[eluser]Ivan A. Zenteno[/eluser]
sorry for big lagg, but I'm do Code: print_r ($this->data); Code: $this->data['smtp_enable'] Code: DEBUG - 2009-09-11 21:39:38 --> Email Class Initialized Best regards
[eluser]Ivan A. Zenteno[/eluser]
I upgraded to version 1.7.2 and the error still appears no longer to do. The new code is here url of code if some like to see it and help me a little bit. This is the debug log. Code: DEBUG - 2009-09-15 00:48:01 --> Language file loaded: language/spanish/form_validation_lang.php The line 78 is : Code: $this->email->subject($subject);
[eluser]Ivan A. Zenteno[/eluser]
I solved my problem, loading the email library within autoload file and put my class method initialize() Thanks to all :lol: |
Welcome Guest, Not a member yet? Register Sign In |