-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.php
executable file
·47 lines (33 loc) · 998 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
require 'bootstrap.php';
try {
// if ($_ENV['MAINTENANCE'] === 'true') {
// // var_dump('em manutenção');
// require 'maintenance.php';
// die();
// }
$data = router();
if (isAjax()) {
die();
}
if (!isset($data['data'])) {
throw new Exception('O índice data está faltando');
}
if (!isset($data['data']['title'])) {
throw new Exception('O índice title está faltando');
}
if (!isset($data['view'])) {
throw new Exception('O índice view está faltando');
}
if (!file_exists(VIEWS.$data['view'].'.php')) {
throw new Exception("Essa view {$data['view']} não existe");
}
$templates = new League\Plates\Engine(VIEWS);
// Render a template
echo $templates->render($data['view'], $data['data']);
// extract($data['data']);
// $view = $data['view'];
// require VIEWS.'master.php';
} catch (Exception $e) {
var_dump($e->getMessage());
}