From 0aa067b783ec3ba374380b82612eb876634c78f8 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 1 Apr 2021 13:27:08 +0300 Subject: Made index.php a router and added the basis of landing view and controller --- src/index.php | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'src/index.php') diff --git a/src/index.php b/src/index.php index 7313cbb..26089e9 100644 --- a/src/index.php +++ b/src/index.php @@ -1,15 +1,25 @@ -

Hello World!

$obj) { - echo "{$obj->id} {$obj->title}
"; - } - echo "
"; +include_once("controllers/LandingController.php"); + +/* The landing page practically acts as our page router + * Thanks https://www.taniarascia.com/the-simplest-php-router/ + */ + +$landingController = new LandingController(); + +$request = $_SERVER['REQUEST_URI']; + +switch ($request) { + case "": + case "/": + $landingController->invoke(); + break; + default: + http_response_code(404); + break; +} ?> -- cgit v1.3.1-26-gb76a