Skip to content

Versioned Libraries

World Wide Web Server edited this page Jul 4, 2012 · 15 revisions

As of Code Igniter v1.4.0, any library can be overridden by a custom one stored within the application/libraries folder. CI uses two different methods for loading libraries.

[h3]System Libraries[/h3] While you can provide your own version of the system-dependent libraries, CI loads the class file directly. This is in contrast to how it loads all other libraries.

[h3]On-demand Libraries[/h3]

Code Igniter comes with various libraries that you can use on-demand. You can also supply your own libraries on a per-application basis. When you request a library, by calling:

[code] $this->load->library('samplelib'); [/code]

CI first checks to see if a [b]method[/b] is defined for loading that library. In this case, it will look for a method called _init_samplelib() within your application controller.

If it doesn't find that, it will search for a file within application/init called "init_samplelib" (with EXT as the extension).

Clone this wiki locally