-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
61 lines (52 loc) · 2.32 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* Front controller
*
* PHP version 7.0
*/
/**
* Composer
*/
require dirname(__DIR__) . '/vendor/autoload.php';
/**
* Error and Exception handling
*/
error_reporting(E_ALL);
set_error_handler('Core\Error::errorHandler');
set_exception_handler('Core\Error::exceptionHandler');
/**
* Routing
*/
$router = new Core\Router();
/** Add the routes
* Je hebt een Controller en een Action
* Zoals Jazz, Food, Home, winkelwagen zijn Controllers.
* Zoals een subpagina van een controller zoals een pagina met info over een restaurant of een artiest is een Action.
*
* De $router->add() methode werkt als volgt:
* Als je een adress hebt als www.google.com/Jazz/Evolve dan is Jazz de controller en Evolve de Action.
* De add methode wordt dan $router->add('/Jazz/Evolve');
*
* Maar stel je hebt geen Action
* Zoals www.google.com/Jazz
* Dan geef je met de Add methode zelf de controller en de action mee
* Dan word het $router->add('Jazz', ['controller' => 'Jazz', 'action' => 'index']); (Index is dus een Action voor de homepagina van het event Jazz)
*
* Je kan ook variables mee geven in de URL als je dat wilt vraag het dan even.
*/
$router->add('', ['controller' => 'Home', 'action' => 'index']);
$router->add('food', ['controller' => 'Food', 'action' => 'index']);
$router->add('dance', ['controller' => 'Dance', 'action' => 'index']);
$router->add('jazz', ['controller' => 'Jazz', 'action' => 'index']);
$router->add('jazz/{day}', ['controller' => 'Jazz', 'action' => 'tickets']);
$router->add('jazz/artist/{artist}', ['controller' => 'Jazz', 'action' => 'artist']);
$router->add('cms', ['controller' => 'Cms', 'action' => 'index']);
$router->add('cms/{action}/{event}', ['controller' => 'Cms']);
$router->add('dance', ['controller' => 'Dance', 'action' => 'index']);
$router->add('dance/locations/{location}', ['controller' => 'dance', 'action' => 'locations']);
$router->add('dance/lineup/{artist}', ['controller' => 'dance', 'action' => 'lineup']);
$router->add('order/checkout', ['controller' => 'MollieController', 'action' => 'checkout']);
$router->add('order/return', ['controller' => 'MollieController', 'action' => 'return']);
$router->add('order/{action}', ['controller' => 'order']);
$router->add('{controller}/{action}');
$router->dispatch($_SERVER['QUERY_STRING']);