Hello I would like to know if someone has any code snippet for customizing 404 not found and error pages ?
Maybe I misunderstood something, but you can modify the existing view scripts:
Do you mean this?
1 Like
Yes. But I would like to create another view for error and 404 not found. And perhaps on bootstrap, catch these errors and show the appropriate view.
You can add on Module.php something like this code:
public function onDispatchError(MvcEvent $event)
{
$response = $event->getResponse();
if ($response->getStatusCode() == 404) {
$event->getViewModel()->setTemplate("layout/404");
}
}
In the view-file you can create a custom design
This is not necessary as it is already set in the configuration:
Do you want multiple designs for 404 or other errors?
Oh, I thought he meant an extra layout for the 404-Page.