Welcome Guest, Not a member yet? Register   Sign In
Trouble extending Loader library
#1

[eluser]mrtopher[/eluser]
I'm trying to add a function or 2 to the default CI loader library and am using the process described in the users guide: http://ellislab.com/codeigniter/user-gui...aries.html.

But, when I try to access my function I get a "Call to undefined function" error.

I replaced my code with a simple test as shown below and still get the error:

Code:
class MY_Loader extends CI_Loader
{

    function MY_Loader()
    {
        parent::CI_Loader();
    }
    
    
    function hi_mom()
    {
        echo 'hi mom';
    }
    
}

When I call

Code:
$this->load->hi_mom();

I get "PHP Fatal error: Call to undefined function: hi_mom() in...".

I've confirmed that the MY_Loader file is being used by CI but for some reason it's not picking up my function.

Any ideas?
#2

[eluser]mrtopher[/eluser]
Anyone have any ideas why this wouldn't be working? I'm not having much luck.
#3

[eluser]m4rw3r[/eluser]
Is it PHP 4?

If that is the case, you have to modify system/codeigniter/base4.php so CI_base extends MY_Loader instead of CI_loader.
#4

[eluser]mrtopher[/eluser]
m4rw3r: Nope... I'm working with PHP 5.
#5

[eluser]gwelter[/eluser]
Not sure if you ever got this resolved, but I ran into the same problem. It turns out the filename is case sensitive so in your application/libraries folder it should say MY_Loader.php exactly. That did the trick for me!

-Gus




Theme © iAndrew 2016 - Forum software by © MyBB