Welcome Guest, Not a member yet? Register   Sign In
Calling header footer views only once -Solved
#1

[eluser]bleu[/eluser]
Instead of calling my header, footer views again and again in all controller methods like this
Code:
public function index()
{
$data['news'] = $this->news_model->get_news();
$data['title'] = 'News archive';

$this->load->view('templates/header', $data);
$this->load->view('news/index', $data);
$this->load->view('templates/footer');
}
and
Code:
public function index2()
{
$data['news'] = $this->news_model->get_news2();
$data['title'] = 'News archive';

$this->load->view('templates/header', $data);
$this->load->view('news/index', $data);
$this->load->view('templates/footer');
}


I would like to call
Code:
$this->load->view('templates/header', $data);

$this->load->view('templates/footer');
just once and just pass the middle part which keeps on changing

How can I achieve that?



Solved with this
http://codeigniter.com/wiki/Header_and_f...very_page/




Theme © iAndrew 2016 - Forum software by © MyBB