08-03-2010, 10:26 PM
[eluser]Unknown[/eluser]
Hi,
I've created my own custom library (application/libraries/MY_Send_email.php) which extends CI_email. I did this as I will be using email functionality a lot in my website. So far within this class I have a function named sendActivation. How do I call this function from my controller? Below I have my class code and below it my controller code. Any help would be awesome. Thanks!
Here is the error I get.
Severity: Notice
Message: Undefined property: MY_Send_email::$email
Filename: libraries/MY_Send_email.php
Line Number: 19
Fatal error: Call to a member function from() on a non-object in C:\wamp\...\application\libraries\MY_Send_email.php on line 19
//LIBRARY
class MY_Send_email extends CI_Email {
function __construct() {
$CI =& get_instance();
parent::CI_Email();
}
function sendActivation(){
line 19 $this->email->from('[email protected]', 'hi');
}
}
//CONTROLLER
function __construct()
{
parent::Controller();
$this->load->library('email');
$this->load->library('MY_Send_email');
}
function whatever(){
$this->my_send_email->sendActivation(); //this is where I get the error
}
Hi,
I've created my own custom library (application/libraries/MY_Send_email.php) which extends CI_email. I did this as I will be using email functionality a lot in my website. So far within this class I have a function named sendActivation. How do I call this function from my controller? Below I have my class code and below it my controller code. Any help would be awesome. Thanks!
Here is the error I get.
Severity: Notice
Message: Undefined property: MY_Send_email::$email
Filename: libraries/MY_Send_email.php
Line Number: 19
Fatal error: Call to a member function from() on a non-object in C:\wamp\...\application\libraries\MY_Send_email.php on line 19
//LIBRARY
class MY_Send_email extends CI_Email {
function __construct() {
$CI =& get_instance();
parent::CI_Email();
}
function sendActivation(){
line 19 $this->email->from('[email protected]', 'hi');
}
}
//CONTROLLER
function __construct()
{
parent::Controller();
$this->load->library('email');
$this->load->library('MY_Send_email');
}
function whatever(){
$this->my_send_email->sendActivation(); //this is where I get the error
}