NorseMan
Member
I get an error on line 38, 39, 52, 56, 58, 63 and 71. I cant find the error. I am looking and looking
Can you help me find it?
Can you help me find it?
Code:
<?php
class EntryPoint
{
private $route;
public function __construct($route)
{
$this->route = $route;
$this->checkUrl();
}
private function checkUrl()
{
if ($this->route !== strtolower($this->route)) {
http_response_code(301);
header('location: ' . strtolower($this->route));
}
}
private function loadTemplate($TemplateFileName, $variables = [])
{
extract($variables);
ob_start();
include __DIR__ . '/../templates/' . $templateFileName;
include ob_get_clean();
}
private function callAction()
{
include __DIR__ . '/../classes/databaseTable.php';
include __DIR__ . '/../includes/dbconnection.php';
$articleTable new DatabaseTable($pdo, 'article', 'id');
$usersTable new DatabaseTable($pdo, 'users', 'id');
if ($this->route === 'article/list') {
include __DIR__ . '/../classes/controllers/articleController.php';
$controller = new articleController($articleTable, $usersTable);
$page = $controller->list();
} elseif ($this->route === '') {
include __DIR__ . '/../classes/controllers/articleController,php';
$controller = new articleController($articleTable, $usersTable);
$page = $controller->home();
} elseif ($this->route === 'article/edit') {
include __DIR__ . '/../classes/contollers/articleController.php';
$controller = new articleController(articleTable, $usersTable);
$page = Controller->edit();
} elseif ($this->route === 'article/delete') {
include __DIR__ . '/../classes/controllers/articleController.php';
$controller = new articleController($articlesTable, $usersTable);
$page $Controller->delete();
} elseif ($this->route === 'register') {
include __DIR__ '/../classes/controllers/registerController.php';
$controller = new registerController($usersTable);
$page = $controller->showForm();
}
return $page
}
public function run()
{
$page = $this->callAction();
$title = $page['title'];
if (isset($page['variables'])) {
$output = $this->loadTemplate($page['template'], $page['variables']);
} else {
output = $this->loadTemplate($page['template']);
}
include __DIR__ . '/../templates/layout.html.php';
}
}