Object oriented CI |
[eluser]Christer_[/eluser]
Hi all - could you give me a hint as to go with this problem - I would like to be able to use current code.. Code: $this->user-id How can i setup this perspective with CI ?
[eluser]Christer_[/eluser]
After a second and third tougth - would this be best to implement as a model with autoload and a construct method that just checks if the session has been initialized and gets the database values from there?
[eluser]Spir[/eluser]
You are not telling enough to be clear. What do you want to accomplish here? Also I guess you meant $this->user->id instead of $this->user-id?
[eluser]jmadsen[/eluser]
CI is built with php. stdClass works the same here as anywhere else.
[eluser]Christer_[/eluser]
What i meen is that i want to do a instance class.. instead of doing Code: $this->user_model->get_name_by_current_user_id($this->session->userdata('userid')) Code: $this->user_model->get_email_by_current_user_id($this->session->userdata('userid')) i could just make a more personal side to another model witch says. Code: $this->user->email but i believe the right way to do this is to make a model "User.php" and just autoload it with Code: class User extends CI_Model { or am i completly missing som points in the mvc pattern here? The reason why i am askin is because someone says i need to extend the CI_Controller with a MY_Controller and go from there. Someone else means its a library since it contains user information Someone, aswell as myself meens it should be model as there is DB interaction and it is to be used within the controller directly.
[eluser]Spir[/eluser]
[quote author="Christer_" date="1336723699"]What i meen is that i want to do a instance class.. instead of doing Code: $this->user_model->get_name_by_current_user_id($this->session->userdata('userid')) Code: $this->user_model->get_email_by_current_user_id($this->session->userdata('userid')) i could just make a more personal side to another model witch says. Code: $this->user->email Code: $this->load->model('user_model', 'user'); |
Welcome Guest, Not a member yet? Register Sign In |