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

[eluser]TheFuzzy0ne[/eluser]
Why do you need a new instance of the Email class?

$this->load->library('email'); loads the Email class so you can access it through $this->email. To auto load the class, you can either put that line of code into your controller constructor, or add it to your autoload.php file, in the right section.

The problem as I see it, is that you're declaring both of those classes in the same file, when perhaps you shouldn't be.

What's wrong with this(?):
./system/application/libraries/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();
    }

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

}


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