Skip to content

Instantly share code, notes, and snippets.

@dwolke
Last active December 20, 2015 22:39
Show Gist options
  • Save dwolke/6206590 to your computer and use it in GitHub Desktop.
Save dwolke/6206590 to your computer and use it in GitHub Desktop.
aktion bei 403, 404 usw.
public function onDispatchError(MvcEvent $e)
{
//url to redirect page to whatever...
var_dump($e->getRouter()->getRequestUri()->getPath());
$statusCode = $e->getResponse()->getStatusCode();
if ($statusCode == 404 || $statusCode == 500) {
$vm = $e->getViewModel();
$vm->setTemplate('layout/contentpage');
$vm->setVariable('statusCode', $statusCode);
} elseif($statusCode == 403){
//DO SOMETHING else?
// TODO: show error page/message and/or redirect to login ?!??
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment