Welcome Guest, Not a member yet? Register   Sign In
Best Practice Question: Views and Session Vars
#11

[eluser]xwero[/eluser]
I'm wondering if it makes sense if the userdata method had a second argument like the uri segment method where the second argument sets the default value.
Code:
$this->session->userdata('username','');
In the session class the userdata method should be changed to
Code:
function userdata($item,$default= null)
{
   if( ! isset($this->userdata[$item]))
   {
     return (is_null($default))?FALSE:$default;
   }
   else
   {
     return $this->userdata[$item];
   }
}


It would fit your needs Wink
#12

[eluser]Kevin Kaske[/eluser]
I just went ahead and got the session variable in the view. Seems to work ok. Thanks for everybody's help!
#13

[eluser]Rick Jolly[/eluser]
Glad you found a solution.

Just a note for future reference though, you can extend controllers. The thread you referenced had a misleading title since it dealt with controllers in subfolders, not extending controllers.
#14

[eluser]Kevin Kaske[/eluser]
HHHHhhhmmm.... I may have to try extending the controller still.

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB