Welcome Guest, Not a member yet? Register   Sign In
best way to do this?
#1

[eluser]Wondering Coder[/eluser]
hi everyone.,

I'm building an application using CI and using this structure most of my controllers:
Code:
function index(){
                $data['mod'] = strtolower(get_class($this));
        $data['role'] = $this->session->userdata('data_id');        
        $dt = $this->session->userdata('user_id');
        ....
                .........
        
        $data['content'] = $this->load->view('panes/com_profile', $data, true);

        $this->load->vars($data);
        $this->load->view('template');
}

function insert(){
                $data['mod'] = strtolower(get_class($this));
        $data['role'] = $this->session->userdata('data_id');        
        $dt = $this->session->userdata('user_id');
        ....
                .........
        
        $data['content'] = $this->load->view('panes/insert', $data, true);

        $this->load->vars($data);
        $this->load->view('template');
}

As you can see I've been using over and over the load->vars and load->view('template') in most of my controller? What's the best way to have this global or have this available in all of my controller?


Messages In This Thread
best way to do this? - by El Forum - 04-10-2011, 03:18 AM
best way to do this? - by El Forum - 04-10-2011, 03:20 AM
best way to do this? - by El Forum - 04-10-2011, 07:34 AM
best way to do this? - by El Forum - 04-10-2011, 07:37 AM
best way to do this? - by El Forum - 04-10-2011, 09:51 AM
best way to do this? - by El Forum - 04-10-2011, 10:18 AM
best way to do this? - by El Forum - 04-11-2011, 09:34 PM
best way to do this? - by El Forum - 04-12-2011, 06:35 AM
best way to do this? - by El Forum - 04-12-2011, 10:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB