Complex Session Data |
[eluser]CI_Newb[/eluser]
The way my app works is that the user logs in and from there, has MANY different things set. I did it this way to setup app permissions, restrictions, themes, etc ... Its working right now using a model to query 2 tables to get permissions, theme file, id, and so forth. That model is loaded by default and every controller function right now has Code: $data['userInfo'] = $this->user_model->find_user(); Is this a good way to handle this or should I be loading all the settings, permissions and stuff into the session data?
[eluser]joedy[/eluser]
I think yours is kinda difficult (hard codding) to settle it. Usually I used : Quote:function validate_user($data_post){ in my model. you can join more tables as your requirement
[eluser]CI_Newb[/eluser]
Only problem i'm guessing with using an array for me is the amount of items it would have to contain. As of right now, i'm pulling apx 20 values from the db tables. Any issues with that many in the session array?
[eluser]joedy[/eluser]
If you read "what is SESSION data?" in CI user guide, it says "..as far as CodeIgniter is concerned, is simply an array". put a huge of data into SESSION could perform the application slow. I'd searched about session limitation, there is nothing about size limitation of session. You can use CodeIgniter's Hooks feature or usually I used a file called "MY_global_controller" (read: http://ellislab.com/codeigniter/user-gui...asses.html) which I set autoload. hopes this smart ass reply help you out
[eluser]CI_Newb[/eluser]
lol not smart ass at all but helpful. I suppose the only way to find out is to give it a whirl eh.
[eluser]sketchynix[/eluser]
You should look into the way codeigniter implements sessions. It is storing the objects in a cookie, which has size limitations but they are pretty high. You definitely shouldn't be querying your database model in every controller to get the users setting. I'd put the settings into the session array when the user logs in
[eluser]CI_Newb[/eluser]
For sure, i'm currently doing that now and will see how it affects performance. Doubt it will honestly. |
Welcome Guest, Not a member yet? Register Sign In |