Added 404 error page

This commit is contained in:
Alfonso Saavedra "Son Link" 2024-04-07 22:41:34 +02:00
parent 6dfce20d7f
commit bcadfb6dd3
No known key found for this signature in database
GPG Key ID: D3594BCF897F74D8
2 changed files with 16 additions and 0 deletions

View File

@ -6,6 +6,7 @@ use CodeIgniter\Router\RouteCollection;
* @var RouteCollection $routes
*/
$routes->get('/', 'Home::index');
$routes->set404Override('App\Controllers\Home::error404');
$routes->get('user/(:any)', 'Users::user/$1');
$routes->get('car/(:any)', 'Cars::index/$1');
$routes->get('track/(:any)', 'Tracks::index/$1');

15
app/Views/404.php Normal file
View File

@ -0,0 +1,15 @@
<?= get_header('404: Page not found') ?>
<div class="container">
<h1>404 - Page Not Found</h1>
<img id="img_404" src="<?= base_url('img/404.svg') ?>" />
<p id="text_404">
<?php if (! empty($message) && $message !== '(null)') : ?>
<?= nl2br(esc($message)) ?>
<?php else : ?>
Sorry! Cannot seem to find the page you were looking for.
<?php endif ?>
</p>
</div>
<?= get_footer() ?>