82 lines
2.9 KiB
PHP
82 lines
2.9 KiB
PHP
|
<?php
|
||
|
session_start();
|
||
|
require __DIR__ . ("/../init.php");
|
||
|
$pathInfo = $_SERVER['PATH_INFO'];
|
||
|
// var_dump ($pathInfo);
|
||
|
|
||
|
$routes = [
|
||
|
'/homepages' => [
|
||
|
'controller' => 'loginController',
|
||
|
'method' => 'homepages' // show Methode anwenden
|
||
|
],
|
||
|
'/index' => [
|
||
|
// 'controller' => 'loginController',
|
||
|
'controller' => 'personController',
|
||
|
'method' => 'index' // index Methode anwenden
|
||
|
],
|
||
|
'/remarks' => [
|
||
|
'controller' => 'personController',
|
||
|
'method' => 'comment' //'show' // show Methode anwenden
|
||
|
],
|
||
|
'/baum' => [
|
||
|
'controller' => 'personController',
|
||
|
'method' => 'baum' // show Methode anwenden
|
||
|
],
|
||
|
'/nachkommen' => [
|
||
|
'controller' => 'personController',
|
||
|
'method' => 'nachkommen' // nachfahren Methode anwenden
|
||
|
],
|
||
|
'/showlist' => [
|
||
|
'controller' => 'personController',
|
||
|
'method' => 'showlist' // show Methode anwenden
|
||
|
],
|
||
|
'/showlist_1' => [
|
||
|
'controller' => 'personController',
|
||
|
'method' => 'showlist_1' // show Methode anwenden
|
||
|
],
|
||
|
'/familienblatt' => [
|
||
|
'controller' => 'personController',
|
||
|
'method' => 'familienblatt' // show Methode anwenden
|
||
|
],
|
||
|
'/familientafel' => [
|
||
|
'controller' => 'personController',
|
||
|
'method' => 'familientafel' // show Methode anwenden
|
||
|
],
|
||
|
'/update' => [
|
||
|
'controller' => 'personController',
|
||
|
'method' => 'update' // show Methode anwenden
|
||
|
],
|
||
|
'/login' => [
|
||
|
'controller' => 'loginController',
|
||
|
'method' => 'login' // index Methode anwenden
|
||
|
],
|
||
|
'/logout' => [
|
||
|
'controller' => 'loginController',
|
||
|
'method' => 'logout' // index Methode anwenden
|
||
|
],
|
||
|
'/dashboard' => [
|
||
|
'controller' => 'loginController',
|
||
|
'method' => 'dashboard' // dashboard Methode anwenden
|
||
|
],
|
||
|
'/privat' => [
|
||
|
'controller' => 'loginController',
|
||
|
'method' => 'privat' // index Methode anwenden
|
||
|
],
|
||
|
'/impressum' => [
|
||
|
'controller' => 'loginController',
|
||
|
'method' => 'impressum' // index Methode anwenden
|
||
|
],
|
||
|
];
|
||
|
|
||
|
// Wenn in der PATH_INFO eine seite gespeichert wurde (z.B. /index oder /post)
|
||
|
// kann sie aus dem array $routes ausgelesen werden. In diesem array ist gespeichert,
|
||
|
// welcher controller zu verwenden ist und welche Methode des controllers anzuwenden ist
|
||
|
// var_dump($routes[$pathInfo]);die();
|
||
|
if (isset($routes[$pathInfo])) { // ist eine PATH_INFO gesetzt?
|
||
|
$route = $routes[$pathInfo]; // zwischenspeichern
|
||
|
$controller = $container->make($route['controller']); // make für den controller setzen
|
||
|
$method = $route['method']; // Methode holen
|
||
|
$controller->$method(); // Controller führt Methode aus
|
||
|
}
|
||
|
?>
|