CodeIgniter not loading extended MY_Exceptions CodeIgniter not loading extended MY_Exceptions codeigniter codeigniter

CodeIgniter not loading extended MY_Exceptions


Try this way

<?class MY_Exceptions extends CI_Exceptions{    public function __construct()    {        parent::__construct();    }    public function show_404($page = '', $log_error = TRUE)    {        if (is_cli())        {            $heading = 'Not Found';            $message = 'The controller/method pair you requested was not found.';        }        else        {            $heading = '404 Page Not Found This Time';            $message = 'The page you requested was not found.';        }        // By default we log this, but allow a dev to skip it        if ($log_error)        {            log_message('error', $heading.': '.$page);        }        echo $this->show_error($heading, $message, 'custom404', 404);//custom404 is in APPPATH.'views/errors/html/custom404.php'        exit(4); // EXIT_UNKNOWN_FILE    }}

I edited code above. I took research and ended with this. I just copied show_404() method from CI_Exceptions class and saw what changes could be done. You can set your message, your header and call your template as well. You can play this way. Also I would suggest you to place $this->load->view('header') and $this->load->view('footer') in custom404.php file itself. In file custom404.php file just echo $heading and $message.