Welcome Guest, Not a member yet? Register   Sign In
Custom error page
#1

[eluser]veledrom[/eluser]
Hi,

I'm using
Code:
show_error('Error messgae', 403)
(for ALL errors) to show error but is there any chance of creating my own (custom) error page instead of printing only "An Error Was Encountered, Error message" note on the screen?

Thanks
#2

[eluser]nagata[/eluser]
Found this while searching thru system core, its basicly the function you call,
see the $template? Its Undocumented variavle of this...
Havent tested anything yet but you can either way take the App/Errors/error_general.php and edit it to your liking, or you can bases on it create your error display page, that way
having to use show_error('Yay', 'ME BE GENIUS', 'custom_rrror');
Code:
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.'.php');
  $buffer = ob_get_contents();
  ob_end_clean();
  return $buffer;
}




Theme © iAndrew 2016 - Forum software by © MyBB