-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
executable file
·33 lines (25 loc) · 905 Bytes
/
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
<?php
//nom de l'application
$nameApp = "app";
//action par défaut
$action = "accueil";
if (key_exists("action", $_REQUEST))
$action = $_REQUEST['action'];
require_once 'lib/core.php';
require_once $nameApp . '/controller/mainController.php';
foreach (glob($nameApp . '/model/*.class.php') as $model)
include_once $model;
session_start();
$context = context::getInstance();
$context->init($nameApp);
$view = $context->executeAction($action, $_REQUEST);
//traitement des erreurs de bases, reste a traiter les erreurs d'inclusion
if ($view === false) {
echo "Une grave erreur s'est produite, il est probable que l'action " . $action . " n'existe pas...";
die;
}
//inclusion du layout qui va lui meme inclure le template view
elseif ($view != context::NONE) {
$template_view = $nameApp . "/view/" . $action . $view . ".php";
include($nameApp . "/layout/" . $context->getLayout() . ".php");
}