I have a library called lib, which contains a class called nusoap.php. I have put lib inside the folder application/libraries/.
When I try to load it, I'm getting the following error:
An Error Was Encountered
Unable to load the requested class: nusoap
This the code I use to load it
class Dealership extends Controller
{
function Dealership()
{
parent::Controller();
$this->load->library('nusoap.php');
}
}
Am I missing anything?
Thanks for helping
Non-existent class: xxx
Avoid use of namespaces
You dont need the .php extension in the $this->load->library() call
The code igniter function that loads libraries does not (unfortunately) search the libraries directory recursively, so if you want to load libs in subfolders you need to do this:
$this->load->library('lib/nusoap')
From the docs (Loader class):
Library files can be stored in subdirectories within the main "libraries" folder, or within your personal application/libraries folder. To load a file located in a subdirectory, simply include the path, relative to the "libraries" folder. For example, if you have file located at:
libraries/flavors/chocolate.php You will load it using:
$this->load->library('flavors/chocolate');You may nest the file in as many subdirectories as you want.
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