I am new to codeigniter and I have been called header and footer for all pages in view.
For this I created a new file in application/core/MY_Loader.php
class MY_Loader extends CI_Loader {
public function template($template_name, $vars = array(), $return = FALSE) {
if ($return):
$content = $this->view('header', $vars, $return);
$content .= $this->view($template_name, $vars, $return);
$content .= $this->view('footer', $vars, $return);
return $content;
else:
$this->view('header', $vars);
$this->view($template_name, $vars);
$this->view('footer', $vars);
endif;
}
}
Controller:
$this->load->template('welcome_message', $data);
What i have to do, to get the header and footer in all pages?
Currently my welcome_message
view file only loaded not the header and footer.