Welcome Guest, Not a member yet? Register   Sign In
Add $this->load->view to all functions?
#2

[eluser]davidbehler[/eluser]
Possible solution would be to write your own function that you call instead of $this->load->view() in your controller. I would extend the CI_Controller class and put that function there:
Create a file called MY_Controller in application/core with this content:
Code:
class MY_Controller extends CI_Controller {
  function __construct() {
    parent::__construct();
  }

  function load_view($view_file, $data) {
    $this->load->view('header');
    $this->load->view($view_file, $data);
    $this->load->view('footer');
  }
}

And now you only have to update your controllers to extend MY_Controller instead of CI_Controller and in your functions you would call $this->load_view('auth/login', $this->data); and remove the $this->load->view('header') and $this->load->view('footer') calls.


Messages In This Thread
Add $this->load->view to all functions? - by El Forum - 04-24-2011, 02:54 AM
Add $this->load->view to all functions? - by El Forum - 04-24-2011, 03:32 AM
Add $this->load->view to all functions? - by El Forum - 04-24-2011, 09:48 AM
Add $this->load->view to all functions? - by El Forum - 04-24-2011, 09:56 AM
Add $this->load->view to all functions? - by El Forum - 04-24-2011, 10:13 AM
Add $this->load->view to all functions? - by El Forum - 04-24-2011, 10:21 AM
Add $this->load->view to all functions? - by El Forum - 04-24-2011, 01:16 PM
Add $this->load->view to all functions? - by El Forum - 04-24-2011, 03:06 PM
Add $this->load->view to all functions? - by El Forum - 04-24-2011, 03:30 PM
Add $this->load->view to all functions? - by El Forum - 04-24-2011, 03:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB