From fe97a9f2559a3b787789af7a7cf690910a2ecce7 Mon Sep 17 00:00:00 2001 From: NaufalArdanni <54439087+NaufalArdanni@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:35:37 +0700 Subject: [PATCH] fix: style 404 Not Found page --- src/App/components/home/NotFound.php | 11 ++++++++++- src/App/views/Routing.php | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/App/components/home/NotFound.php b/src/App/components/home/NotFound.php index 0b3e4f9..8342c03 100644 --- a/src/App/components/home/NotFound.php +++ b/src/App/components/home/NotFound.php @@ -3,10 +3,19 @@ <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <link rel="stylesheet" href="../../public/styles/home/Home.css"> + <link rel="stylesheet" href="../../public/styles/Global.css"> <title>404 Not Found</title> </head> <body> - 404 Not Found + <?php + include(dirname(__DIR__) . '/template/Navbar.php'); + ?> + + <main> + <h1>404 Not Found</h1> + <p>The requested page does not exist.</p> + </main> </body> </html> \ No newline at end of file diff --git a/src/App/views/Routing.php b/src/App/views/Routing.php index 4642cbd..f7e227d 100644 --- a/src/App/views/Routing.php +++ b/src/App/views/Routing.php @@ -24,7 +24,7 @@ class Routing { $filename = str_replace('.php', '', $url[1]); $filename = ucfirst($filename); $controllerName = $filename . "Controller"; - $controllerFile = $controllerDir . '/' . $routes[$filename] . '/' . $controllerName . '.php'; + $controllerFile = $controllerDir . '/' . ($routes[$filename] ?? '') . '/' . $controllerName . '.php'; if(!file_exists($controllerFile)) { $controllerName = "NotFoundController"; $controllerFile = $controllerDir . '/home/' . $controllerName . '.php'; -- GitLab