Welcome Guest, Not a member yet? Register   Sign In
show_404() doesn't use my custom 404 page

Hello all,

On my CodeIgniter site, I set up a custom 404 page using the following code.

PHP Code:
$route['404_override'] = 'error_pages/error_404_custom'

PHP Code:
class Error_pages extends CI_Controller
    public function __construct()
function error_404_custom()

helpers/mv_helper.php (autoloaded)

PHP Code:
    if ( ! function_exists('load_page_with_great_races_sidebar') )
        function load_page_with_great_races_sidebar($obj$page_name$data NULL)
            $data['great_races'] = html_escape($obj->race_model->get_races());

Works like a charm in most scenarios. Except one. If I try to use the show_404() function in a controller to throw a 404 error manually, I get the generic 404 page (which I left in the views/errors/html folder and didn't delete).

What should I change so that my custom 404 page gets loaded by the show_404() function? Or should I use a different function?

(I don't think I can simply replace views/errors/html/error_404.php with my custom error page, because I also do a database query and load the header and footer)


Messages In This Thread
show_404() doesn't use my custom 404 page - by AdmiralAdama - 09-06-2016, 05:56 AM

Theme © iAndrew 2016 - Forum software by © MyBB