-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
81 lines (72 loc) · 2.27 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
<?php
foreach (glob("controllers/dw/*.php") as $file) {
require $file;
}
// date_default_timezone_set('America/Chicago');
use Slime\render;
$app->get('/', function ($req, $res, $args) {
if (!isset($_ENV['SITE_TITLE'])){
return render::redirect($req, $res, '/configure');
}else{
return render::hbs($req, $res, [
'layout' => '_layouts/base',
'template' => 'index',
'title' => $_ENV['SITE_TITLE'],
'data' => [
'current_home' => true,
]
]);
}
});
$app->get('/demo/{page}[/]', function ($req, $res, $args) {
$subnav = false;
if ($args['page'] == 'first'){
$subnav = [
[
'href' => '?subnav=1',
'title' => 'Subnav 1',
'current' => isset($_GET['subnav']) && $_GET['subnav'] == '1' || !isset($_GET['subnav']) ? true : false
],
[
'href' => '?subnav=2',
'title' => 'Subnav 2',
'current' => isset($_GET['subnav']) && $_GET['subnav'] == '2' ? true : false
],
[
'href' => '?subnav=3',
'title' => 'Subnav 3',
'current' => isset($_GET['subnav']) && $_GET['subnav'] == '3' ? true : false
]
];
}
if ($args['page'] == 'second'){
$subnav = [
[
'href' => '?subnav=different-subnav',
'title' => 'Different Subnav',
'current' => isset($_GET['subnav']) && $_GET['subnav'] == 'different-subnav' || !isset($_GET['subnav']) ? true : false
],
[
'href' => '?subnav=ok-cool',
'title' => 'OK Cool',
'current' => isset($_GET['subnav']) && $_GET['subnav'] == 'ok-cool' ? true : false
],
[
'href' => '?subnav=new-thing',
'title' => '+ New Thing',
'current' => isset($_GET['subnav']) && $_GET['subnav'] == 'new-thing' ? true : false
]
];
}
return render::hbs($req, $res, [
'layout' => '_layouts/base',
'template' => 'index',
'title' => 'DEMO ' . $args['page'] . ' - ' . $_ENV['SITE_TITLE'],
'data' => [
'current_first' => $args['page'] == 'first' ? true : false,
'current_second' => $args['page'] == 'second' ? true : false,
'current_third' => $args['page'] == 'third' || $args['page'] == 'fourth' || $args['page'] == 'fifth' || $args['page'] == 'sixth' ? true : false,
'subnav' => $subnav,
]
]);
});