[eluser]jedd[/eluser]
[quote author="thirteen" date="1262548942"]hi jedd...i have this in a controller
[/quote]
How many controllers do you have? If more than one, you should relocate this to MY_Controller
I think there are two broad ways to approach the problem.
A) Controller-based - so you determine which view partials to generate based on the result of is_logged_in() - and these view partials are then bundled together to produce your final full view
B) View-based - you pass the result of is_logged_in() to your view(s) and let it decide about the view output it generates.
My preference is (A) except for near-trivial 'display logic' decisions, which I'm happy to do in view files.
If you choose (B), you just need to do something like this in MY_Controller or your constructor(s):
Code:
$this->data['is_logged_in'] = is_logged_in();
...
$this->load->view ('foo', $this->data);