Skip to content

Instantly share code, notes, and snippets.

@smgladkovskiy
Created November 2, 2010 13:14
Show Gist options
  • Save smgladkovskiy/659583 to your computer and use it in GitHub Desktop.
Save smgladkovskiy/659583 to your computer and use it in GitHub Desktop.
Error Controller
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Controller Error
*
* @package Templates
* @author Kohana-World Development Team
* @author Sergei Gladkovskiy <smgladkovskiy@gmail.com>
* @license MIT License
* @copyright 2011 Kohana-World Development Team
*/
class Controller_Error extends Controller_Template {
public $template = 'frontend/template/error';
public function before()
{
$status = $this->request->action();
$message = __('Page not found');
if($status == 500)
{
$this->_ajax = TRUE;
$message = base64_decode($this->request->param('message'));
}
else
{
$this->_ajax = FALSE;
}
$this->_auth_required = FALSE;
$this->request->action('show');
$this->response->status($status);
$this->response->send_headers();
parent::before();
$this->template->title = __('Error :error_code', array(':error_code' => $this->response->status()));
$this->template->content = View::factory('frontend/content/error')
->set('status', $status)
->set('message', $message)
;
}
public function action_show(){}
} // End Controller_Error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment