CodeIgniter Forums
class Dashboard extends API - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: class Dashboard extends API (/thread-3602.html)



class Dashboard extends API - El Forum - 10-12-2007

[eluser]jkevinburton[/eluser]
I want to create a library class called API which should extends the Controller.
So when I create controllers, all I have to do is say:

Code:
class Dashboard extends API {
     function Dashboard() {
             parent::API();
     }
}

I autoloaded the api class.. but when I ran the controller, it told me that API class didn't exist.....

any insight?

Kevin


class Dashboard extends API - El Forum - 10-15-2007

[eluser]Unknown[/eluser]
CI doesn't autoload the API.php file when called from a child.

Add
Code:
require('api.php');
above your "class Dashboard extends API {" and it should work.

Brad