[eluser]cyrigniter[/eluser]
Hello,
I want to create a class named User, which would contain all information relative to a.. user, given her id in my DB.
The instanciation would be :
Code:
$me = new User($this->session->userdata('id'));
the User class would make calls to the database to fetch useful information (user name, e-mail, etc.).
And from there I'm stuck :
I don't know where to put my User.php class file. I put it in a application/classes folder, and then wanted it to autoload. I created a MY_Controller extending CI_Controller, but with autoload, and changed the extension of my controllers to call MY_Controller instead of CI_Controller, and that would not work. I manually included the class (require_once 'User.php') and then of course, when I make DB calls (with CI syntax) I get errors cause I cannot use my Models in this class because it extends nothing from CI ($this->load gives an error). All this makes sense to me, but I just don't know what to do to get things done. Maybe creating a new model just for that class ? or is there another way to do it ?