Welcome Guest, Not a member yet? Register   Sign In
Do I need to load My_ classes manually?

I have a class named "My_admin" which extends the controller class, and its inside the library folder. I then extend this "My_admin" class and create other classes which are for an admin area. Anyway I couldn't get that far because I can't extend the "My_admin" class in other controllers. It throws an error saying..

Fatal error: Class 'My_admin' not found........

Do I need to load "My_admin" manually? I'm using a linux server and how should I named my classes? I'm asking this because when I migrate the application from windows to linux I got some file naming issues.

Thank you

You'll need to either use an autoloader to load such a class (more on php.net) or just include it before the class decleration:
require APPPATH . 'libraries/My_admin.php';

You only use the MY_ prefix when extending native CI things, like a library.

class MY_Form_validation extends CI_Form_validation

Then if the Form_validation library is autoloaded, it will autoload MY_Form_validation.

Its only for extending native CI classes though, not your own functions (unless those extend a native CI class)


Theme © iAndrew 2016 - Forum software by © MyBB