Welcome Guest, Not a member yet? Register   Sign In
A better way to OOP core libraries??
#1

[eluser]daveWid[/eluser]
I want to extend the Email class, but since I have different sections of the website, I want to have different classes to handle the emails being sent out to keep everything clean.

Here is what I have

application/MY_Email.php
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class MY_Email extends CI_Email
{
    public function MY_Email()
    {
        parent::CI_Email();
    }
}

class NewEmail extends MY_Email
{
    public function NewEmail()
    {
        parent::MY_Email();
    }

    public function cool_method($params)
    {
        // Method code here
    }

}

And in my controller where I want to send the email I have this

Code:
$this->load->library('email');
$email = new NewEmail();
$email->cool_method($params);

All of this works great, but I was wondering if there was a way to load up the NewEmail class directly. Is there a way to call

Code:
$this->load->library('Newemail');

and have it autoload the CI_Email class?? I want to extend the CI_Email class without holding a reference to the base CI class with get_instance().

Thanks for any help in advance.


Messages In This Thread
A better way to OOP core libraries?? - by El Forum - 04-03-2009, 10:05 AM
A better way to OOP core libraries?? - by El Forum - 04-03-2009, 11:42 AM
A better way to OOP core libraries?? - by El Forum - 04-03-2009, 12:44 PM
A better way to OOP core libraries?? - by El Forum - 04-03-2009, 01:25 PM
A better way to OOP core libraries?? - by El Forum - 04-03-2009, 03:15 PM



Theme © iAndrew 2016 - Forum software by © MyBB