views:

35

answers:

1

How do you get CodeIgniter to load views before it loads the files in application/errors?

I have custom error pages but I want them to be displayed beneath the header and menu_bar views.

+1  A: 

You can take a look to the file Exceptions.php, is the library that contains the show_error(). I paste this function here:

function show_error($heading, $message, $template = 'error_general', $status_code = 500)
{
    set_status_header($status_code);

    $message = '<p>'.implode('</p><p>', ( ! is_array($message)) ? array($message) : $message).'</p>';

    if (ob_get_level() > $this->ob_level + 1)
    {
        ob_end_flush(); 
    }
    ob_start();
    include(APPPATH.'errors/'.$template.EXT);
    $buffer = ob_get_contents();
    ob_end_clean();
    return $buffer;
}

As you see they are including the error directly as a file, they don't use any other library.

Isern Palaus