PHP/codeigniter - use of exit()
- by Patrick
I have a few pages that require login, so all controllers that link to these pages start with 
$this->checkSession();
//...rest of the code
CheckSession should verify the session is still live, otherwise display a message and stop the execution of the rest of the code in the controller:
function checkSession()
{
    if (!$this->session->userdata('is_logged_in'))
    {
        //the session has expired!
        $data['main'] = 'confirmation_message';
        $data['title'] = "Session expired";
        $this->load->vars($data);
        $this->load->view('template');
        exit();
    }
}
.
I was expecting these instructions to happen in sequence, but I only get a blank page.
How can I make sure exit() gets executed only after all views are loaded?