Properly handle 404s

master
Sven Slootweg 12 years ago
parent 89dffba731
commit 7737a2e5ad

@ -19,6 +19,7 @@ try
}
catch (NotFoundException $e)
{
http_status_code(404);
$sPageContents = NewTemplater::Render("404", $locale->strings, array());
return;
}

@ -81,7 +81,16 @@ $router->routes = array(
)
);
$router->RouteRequest();
try
{
$router->RouteRequest();
}
catch (RouterException $e)
{
http_status_code(404);
$sPageTitle = "Page not found";
$sPageContents = NewTemplater::Render("404", $locale->strings, array());
}
echo(NewTemplater::Render("layout", $locale->strings, array("contents" => $sPageContents, "title" => $sPageTitle,
"padded" => (isset($router->uVariables['padded']) ? $router->uVariables['padded'] : true))));

Loading…
Cancel
Save