CodeIgniter Forums
Extending a 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: Extending a Library (/showthread.php?tid=19671)



Extending a Library - El Forum - 06-15-2009

[eluser]n0xie[/eluser]
Is it possible to extend a custom library? I'm not talking about a Core Library, but something like this:
Code:
class mylibrary{}

Code:
class somelibrary extend mylibrary{}

Code:
// some controller
$this->load->library('somelibrary');



Extending a Library - El Forum - 06-15-2009

[eluser]Dam1an[/eluser]
Yeah, but you would need to specify the include path manually, so
Code:
include APPPATH.'libraries/My_library.php';
class Some_library extends My_library {
  ...
}



Extending a Library - El Forum - 06-15-2009

[eluser]n0xie[/eluser]
Yeah that's what I thought. Looks ugly so I guess I just have to edit the library. I was hoping I could use one of my libraries and then override one of the functions but I guess editing will get me the same result.

Thanks for the quick answer.