Projekt

Obecné

Profil

Stáhnout (596 Bajtů) Statistiky
| Větev: | Tag: | Revize:
1
<?php
2

    
3
namespace App\FrontModule\Presenters;
4

    
5
use Nette;
6

    
7

    
8
final class Error4xxPresenter extends Nette\Application\UI\Presenter
9
{
10
	public function startup()
11
	{
12
		parent::startup();
13
		if (!$this->getRequest()->isMethod(Nette\Application\Request::FORWARD)) {
14
			$this->error();
15
		}
16
	}
17

    
18

    
19
	public function renderDefault(Nette\Application\BadRequestException $exception)
20
	{
21
		// load template 403.latte or 404.latte or ... 4xx.latte
22
		$file = __DIR__ . "/templates/Error/{$exception->getCode()}.latte";
23
		$this->template->setFile(is_file($file) ? $file : __DIR__ . '/templates/Error/4xx.latte');
24
	}
25
}
(1-1/4)