I want my error_404.php to appear in my site template views. I extended the CI_Exceptions (MY_Exceptions) class and redefined the show_404 () and show_error () methods. Now what I want to do is upload a view file. Optimally, I would like to load the _header () and _footer () methods into the MY_Controller class. Is it possible somehow?
class MY_Exceptions extends CI_Exceptions {
public function __construct(){
parent::__construct();
}
function show_404($page = '')
{
$heading = "404 Page Not Found";
$message = "The page you requested was not found for some strange reason...";
log_message('error', '404 Page Not Found --> '.$page);
$CI =& get_instance();
$CI->load->view('template/header');
echo $this->show_error($heading, $message, 'error_404', 404);
$CI->load->view('template/footer');
exit;
}
function show_error($message, $status_code = 500)
{
$error =& load_class('Exceptions');
echo $error->show_error('An Error Was Encountered', $message, 'error_general', $status_code);
exit;
}
}
But I can’t do it. Any suggestions?
source
share