I am trying to extend a library in codeigniter. The only way to do so seems to include the original library using require_once
then load the extended library using $this->load->library()
right now I have tried
require_once('ion_auth.php');
require_once('home/SITE_NAME/public_html/FOLDER_NAME/application/libraries/ion_auth.php')
require_once('/home/SITE_NAME/public_html/FOLDER_NAME/application/libraries/ion_auth.php')
but unfortunately not luck..... I keep getting this error
Message: require_once(...) [function.require-once]: failed to open stream: No such file or directory
Weird thing is though this works on my local xampp environment but not on the actual server.
Use CodeIgniter's built in constant, APPPATH
require_once(APPPATH.'libraries/ion_auth.php');
If the library is a codeigniter specific library, as sbaaaang points out, you should use:
$this->load->library('ion_auth');
However, if the library is just a generic PHP class or set of functions, the codeiginter loader may not recognize it. Then you will need to use either one of the generic loading operators (include, include_once, require, require_once), with the APPPATH constant, as also pointed out:
require_once(APPPATH.'libraries/ion_auth.php');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With