I am trying to create a header / body / footer template in CodeIgniter similar to that described at: Header and footer in CodeIgniter
My code stored at \application\core\MY_loader.php:
<?php
class MY_Loader extends CI_Loader {
public function load_template($template_name, $vars = array(), $return = FALSE)
{
if($return):
$content = $this -> view('templates/header', $vars, $return);
$content .= $this -> view($template_name, $vars, $return);
$content .= $this -> view('templates/footer', $vars, $return);
return $content;
else:
$this -> view('templates/header', $vars);
$this -> view($template_name, $vars);
$this -> view('templates/footer', $vars);
endif;
}
}
?>
My controller code stored at application\controllers\managers.php:
class Managers extends CI_Controller {
function login()
{
$this -> load -> load_template('managers/login');
}
}
When I browse to BASE_URL/managers/login, I get this error:
Call to undefined method CI_Loader::load_template()
My interpretation of this is that the system is not extending CI_Loader with MY_Loader, but is instead disregarding MY_Loader entirely. This setup was working on my local install of the site when I was running it under XAMPP, but it stopped working after I ported the site to a web host. I don't remember changing the CI configuration (although I might have), nor do I know if this is due to a configuration issue at the new host.
I am looking for any guidance as to what might be preventing MY_loader from extending CI_loader. I haven't been able to find any similar reports; all the other issues I've found related to MY_loader assume that the override is already working.