CodeIgniter Forums
Trouble extending Loader library - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Trouble extending Loader library (/showthread.php?tid=13730)



Trouble extending Loader library - El Forum - 12-03-2008

[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-guide/general/creating_libraries.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?


Trouble extending Loader library - El Forum - 12-04-2008

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


Trouble extending Loader library - El Forum - 12-18-2008

[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.


Trouble extending Loader library - El Forum - 12-18-2008

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


Trouble extending Loader library - El Forum - 08-14-2009

[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