[eluser]jbly[/eluser]
hey all,
n00b here.
i was wanting to make my sidebars dynamic to the pages that they are specific to. basically i wanted to separate my main view with the sidebar associated with it.
what i did was section off the sidebar into its own file in /views/sidebars/s_dashboard.php for instance.
i include the sidebar i want to load in the array i pass from controller to the view that is being loaded and have a default sidebar load if nothing is set.
so far so good.
the issue is that the session variable that i define in the main view is then inaccessible in the sidebar loaded into that view. so, for instance: the dashboard.php has this at the top of it:
Code:
<?php
//grab user session
$sesh = $this->session->all_userdata();
?>
but then i get an error of
undefined variable when the sidebar tries to use it.
i dont' want to have to paste the above code into the top of each sidebar, that seems inefficient and inappropriate. so too a global variable doesn't seem to be an elegant solution.
i'm not sure what to do here. and actually there may be a better way to deal with the user's session than how i was going about it to begin with, so i'm all ears to learning what the best, most efficient and elegant solution would be in this case.
thanks for your patience and help-