-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
62 lines (43 loc) · 1.63 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
62
<?php
session_start();
if (!defined('ABSPATH'))
define('ABSPATH', dirname(__FILE__) . '/');
// Root folder => We make sure we are in this root folder and not anywhere else.
require ABSPATH . 'includes/config.inc.php';
require ABSPATH . 'includes/functions.php';
// Autoload.
spl_autoload_register(function ($class) {
require_once ABSPATH . 'lib/' . $class . '.php';
});
// Connexion.
$dbh = DB::getInstance();
// Class
$helper = new Helper();
// Requête
$_GET['page'] = isset($_GET['page']) ? $_GET['page'] : 'home';
// If the RequestGet page does exist, we set it to its value from the URL, else we set it to home.
require ABSPATH . '/includes/header.inc.php'; // Constante magique (retourne le chemin absolu).
?>
<!--Main layout-->
<main>
<?php if ($_GET['page'] == 'home'): ?>
<?php get_template_part('home'); ?>
<?php elseif ($_GET['page'] == 'burger'): ?>
<?php get_template_part('burger'); ?>
<?php elseif ($_GET['page'] == 'burgers'): ?>
<?php get_template_part('burgers'); ?>
<?php elseif ($_GET['page'] == 'drink'): ?>
<?php get_template_part('drink'); ?>
<?php elseif ($_GET['page'] == 'drinks'): ?>
<?php get_template_part('drinks'); ?>
<?php elseif ($_GET['page'] == 'profile'): ?>
<?php get_template_part('profile'); ?>
<?php elseif ($_GET['page'] == 'cart'): ?>
<?php get_template_part('cart'); ?>
<?php else: ?>
<?php get_template_part('error'); ?>
<?php endif; ?>
</main>
<!--/Main layout-->
<?php
require ABSPATH . '/includes/footer.inc.php';