3

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

2 Answers 2

4

Non-existent class: xxx

Avoid use of namespaces

Sign up to request clarification or add additional context in comments.

Comments

3
  1. You dont need the .php extension in the $this->load->library() call

  2. 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.

6 Comments

I added .php then removed, but no better result.
@Richard77 can you post the class code for nusoap.php? Have you created a property for the code Igniter instance reference?
nusoap.php is a big class to post it here. Here's the download link sourceforge.net/projects/nusoap/files/latest/download. How do I create created a property for the code Igniter instance reference? I'm sorry, this is the first time I do CodeIgniter and PHP.
Very strange. When I add "lib/nusoap" then a I get a different error saying: no-existent class.
@Richard77 its because the class name in nusoap.php is nusoap_base, i would try changing the class name to Class nusoap - hopefully it wont cause problems with the existing library
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.