On your frontend applications you may want to have nice and useful error pages for your users (both human and non-human: bots, spiders...).

Typical cases of page not found (Error 404) or internal error (Error 500) are already handled by BEdita: correct HTTP error codes are sent to user-agent/browser, some basic information is displayed for the user, details of what happened are written to error log file.

Customizing the view for your users in these cases is straightforward and very easy, you simply have to modify these files:

  • views/layouts/error.tpl - this is the common layout for your error pages, it could be similar to views/layouts/default.tpl - i.e. your default template layout - here a meta code snippet example
< html>
< head>
	< meta name="..." content="..."> 

	< title>There was an error...

	{$html->css('....')}
	{$javascript->link('.....')}
< /head>
< body>
  {$view->element('header')}

  {$content_for_layout}

  {$view->element('footer')}
< /body>
< /html>

 

You don't have to write this template: if you don't write it, the default one is used, which contains just
{$content_for_layout}

  • views/errors/error404.tpl - here you can specify what to display in {$content_for_layout} in case of a page not found/404 error, it could be a complete HTML page if you didn't create your common error layout, or something like this code snippet

 

This page is missing

The page you requested is not available. You may have followed a corrupt external link or mis-typed a URL.

Please.....

 

  • views/errors/error500.tpl - this is the equivalent page for "internal server error"/500 error page, where you can specify your {$content_for_layout} in this case - it works exactly like the error404.tpl page