-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
104 lines (79 loc) · 2.58 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
///// THE ONLY ONE ENTRY POINT \\\\\
ini_set('display_errors',1);
error_reporting(E_ALL);
require_once("yieldownEngine/Yieldown.php");
require_once("yieldownEngine/Cache.php");
/*******************************************************************************
* MANDATORY VARS
* To build page or to identify cached pages
*
*/
/** Pre-processing controler : Scripting before building the page */
$ctrl = 'homeCtrl.php';
/** View : The global page template */
$view = 'standardView.php';
/** Sub-view : The sub content to load into the view */
$subview = 'homeSubview.php';
/** [optional] Another sub-subview */
$subsubview = null;
/** Title : The HTML/Head title */
$title = "L'histoire du Jeans";
/** Description : The HTML/Head description */
$description = "L'histoire du jeans : pantalon à coutures, coupé dans une toile denim.";
/** Keywords : The HTML/Head keywords */
$keywords = "jeans, markdown, yieldown, demo";
/** Caching : Enable or not the cache functionality */
$cacheEnable = false;
/*******************************************************************************
* Altering mandatory vars
*
*/
if (isset($_GET['p']) and !empty($_GET['p']) ) {
$p=$_GET['p'];
switch ($p) {
case 'blog':
$subview = null;
$ctrl = 'blogCtrl.php';
break;
case 'history':
$subview = 'historySubview.php';
$ctrl = 'historyCtrl.php';
break;
case 'tone':
$subview = 'toneSubview.php';
$ctrl = 'toneCtrl.php';
break;
case 'cut':
$subview = 'cutSubview.php';
$ctrl = 'cutCtrl.php';
break;
case 'error':
default:
$errMsg = "La page '$p' n'a pas était trouvée.";
$subview = 'errorSubview.php';
$ctrl = 'errorCtrl.php';
$cacheEnable = false;
break;
}
}
/*******************************************************************************
* Assembling the page
*
*/
Cache::enable($cacheEnable);
Cache::shortcut(); // Try to return the cached page if it clearly identify (view+subview+ctrl)
try {
require('controller/standardCtrl.php');
require('controller/'.$ctrl);
} catch (Exception $e) {
$cacheEnable = false;
$errMsg = $e->getMessage();
$subview = 'errorSubview.php';
require('controller/errorCtrl.php');
}
Cache::shortcut(); // Try again to return the cached page if it clearly identify (view+subview+ctrl)
Cache::start(); // Start to generate a new cached page
require('view/'.$view); // Using $subview, $title, $description, $keywords
Cache::end(); // Save the cached page
?>