Summary Files Commits Branches @commit @diff @stats
path: root / src / index.php
diff options
context:
space:
mode:
Commit0aa067b783ec3ba374380b82612eb876634c78f8 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-04-01 13:27:08 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-04-01 13:27:08 +0300
Filesa2c01131f4176013873449f0bd5075762a55f357 /src/index.php
devrix-job-board-0aa067b783ec3ba374380b82612eb876634c78f8.tar
devrix-job-board-0aa067b783ec3ba374380b82612eb876634c78f8.tar.gz
devrix-job-board-0aa067b783ec3ba374380b82612eb876634c78f8.zip
Parentff5e34d0a5e07ff2f2181f362044cb77f262c147 (diff)
Made index.php a router and added the basis of landing view and controller
1 files changed, 18 insertions, 8 deletions
-rw-r--r--src/index.php26
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 @@
<?php require "document-top.php"; ?>
-<p>Hello World!</p>
<?php
- include_once("models/JobOffer.php");
+include_once("controllers/LandingController.php");
- $jb = new JobOffer("Test", "A test", "TheTest", 11);
- // JobOffer::insertInDB($jb);
- foreach(JobOffer::getAllFromDB() as $key => $obj) {
- echo "{$obj->id} {$obj->title}<br>";
- }
- echo "<br>";
+/* 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;
+}
?>
<?php require "document-bot.php"; ?>