-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
42 lines (31 loc) · 1.13 KB
/
index.php
File metadata and controls
42 lines (31 loc) · 1.13 KB
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
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once __DIR__ . '/src/Classes/Bramus/Router/Router.php';
require __DIR__ . '/src/Classes/Smarty/Smarty.class.php';
require __DIR__ . '/src/Controllers/Public/Main.class.php';
$tpl = new Smarty;
$router = new \Bramus\Router\Router();
$router->all('/', 'Main@index');
$template = explode("@",$router->fn);
$router->run(function() use ($tpl) {
$showInNav = array(
"/" => "HOME",
);
$tpl->setTemplateDir(__DIR__."/templates/v1/");
$templateDir = $GLOBALS["template"][0]."/".$GLOBALS["template"][1].".tpl";
$routerUrls = $GLOBALS["router"]->afterRoutes["GET"];
$routerUrlsShow = array();
foreach ( $routerUrls as $urls){
foreach ($showInNav as $key => $value){
if($key == $urls["pattern"]){
$urls["label"] = $value;
$routerUrlsShow[] = $urls;
}
}
}
$GLOBALS["tpl"]->assign("routerUrls", $routerUrlsShow);
$GLOBALS["tpl"]->assign("includeDir", "/templates/v1/".$GLOBALS["template"][0]."/");
$tpl->display($templateDir);
});