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

[eluser]sahanlak[/eluser]
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..

Code:
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
#2

[eluser]Jelmer[/eluser]
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:
Code:
require APPPATH . 'libraries/My_admin.php';
#3

[eluser]CroNiX[/eluser]
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)

http://ellislab.com/codeigniter/user-gui...aries.html




Theme © iAndrew 2016 - Forum software by © MyBB