CodeIgniter Forums
Extending core classes (like Loader) in Application Packages? - 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: Extending core classes (like Loader) in Application Packages? (/showthread.php?tid=46916)



Extending core classes (like Loader) in Application Packages? - El Forum - 11-20-2011

[eluser]aidehua[/eluser]
Is it possible to extend core classes like Loader from an application package?

I've got a package which I autoload like this:

Code:
$autoload['packages'] = array('../shared_packages');

Inside my shared_packages folder I've got

/helpers
/libraries
/views

And these all work fine.

But I've also got a MY_loader.php file which, as it extends the core Loader class, belongs in a /core folder.

When I place it in the /application/core/ folder, it works as intended.

But I really need it to be in my /shared_packages folder so I can share it across applications.

However, when I place it in /shared_packages/core/MY_loader.php, it does not work: MY_loader is not being loaded, and the default Loader class is used instead.

Is it possible to extend core classes from within an application package like this?