diff --git a/CSY2028/EntryPoint.php b/CSY2028/EntryPoint.php index 581441f..e9e5594 100644 --- a/CSY2028/EntryPoint.php +++ b/CSY2028/EntryPoint.php @@ -16,6 +16,8 @@ class EntryPoint { public function run() { $route = \ltrim(\explode('?', $_SERVER['REQUEST_URI'])[0], '/'); + + if ($route == '') { $route = $this->routes->getDefaultRoute(); } @@ -35,7 +37,7 @@ class EntryPoint { $functionName = $functionName . 'Submit'; } - $page = $this->routes->getController($controllerName); + $page = $this->routes->getController($controllerName, $functionName); if ($page == null) { $page = $this->routes->notFound(); } diff --git a/CSY2028/Routes.php b/CSY2028/Routes.php index defb9cf..cf7654d 100644 --- a/CSY2028/Routes.php +++ b/CSY2028/Routes.php @@ -1,7 +1,7 @@ 'admin.html.php', + return ['template' => 'login.html.php', 'title' => 'Jo\'s Jobs- Login', 'vars' => $this->vars]; } diff --git a/jobs/controllers/User.php b/jobs/controllers/User.php new file mode 100644 index 0000000..682eb84 --- /dev/null +++ b/jobs/controllers/User.php @@ -0,0 +1,20 @@ +usersTable = $usersTable; + $this->catsTable = $catsTable; + $this->vars['cats'] = $this->catsTable->findAll(); + $this->vars['response'] = ''; + } + + public function login() { + return ['template' => 'login.html.php', + 'title' => 'Jo\'s Jobs- Login', + 'vars' => $this->vars]; + } +} \ No newline at end of file