Welcome Guest, Not a member yet? Register   Sign In
One if statement to rule them all
#1

[eluser]dennismonsewicz[/eluser]
Is there anyway to write the following without having to write it in each function?

Code:
function main() {
        if($this->session->userdata('logged_in') == TRUE) {
            $data['username'] = $this->session->userdata('email');
            $data['firstN'] = $this->session->userdata('first_name');
            $data['lastN'] = $this->session->userdata('last_name');
            $data['city'] = $this->session->userdata('city');
            $data['state'] = $this->session->userdata('state');
            $this->load->view('mrmain/includes/header_view');
            $this->load->view('admin/main_view', $data);
            $this->load->view('mrmain/includes/footer_view');    
        } else {
            redirect('/');
        }    
    }

I am interested in not have to write the if 'logged_in' == TRUE everytime I write a new function in the admin section... how would I write this once in my parent function?


Messages In This Thread
One if statement to rule them all - by El Forum - 09-08-2009, 06:36 PM
One if statement to rule them all - by El Forum - 09-08-2009, 07:43 PM
One if statement to rule them all - by El Forum - 09-08-2009, 07:50 PM
One if statement to rule them all - by El Forum - 09-08-2009, 08:08 PM
One if statement to rule them all - by El Forum - 09-08-2009, 08:15 PM
One if statement to rule them all - by El Forum - 09-09-2009, 12:10 AM
One if statement to rule them all - by El Forum - 09-09-2009, 01:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB