-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
76 lines (69 loc) · 1.49 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
<?php
require_once("php/globals.php");
require_once("php/controllers.php");
$requestUri = getCurrentUri();
$routes = getRoutes($requestUri);
if(count($routes) < 1)
{
home_page_controller();
}
else if(isset($routes[0]))
{
if(strtolower($routes[0]) == "home")
{
if(!isset($routes[1]))
{
home_page_controller();
}
else if(isset($routes[1]))
{
if(strtolower($routes[1]) == "strategy")
{
strategy_page_controller();
}
else if(strtolower($routes[1]) == "visualization")
{
visualization_page_controller();
}
else if(strtolower($routes[1]) == "video")
{
video_page_controller();
}
else if(strtolower($routes[1]) == "training")
{
training_page_controller();
}
else if(strtolower($routes[1]) == "contact")
{
contact_page_controller();
}
else if(strtolower($routes[1]) == "spinn")
{
spinn_page_controller();
}
}
}
}
//get the current uri
function getCurrentUri()
{
$basepath = implode('/', array_slice(explode('/', $_SERVER['SCRIPT_NAME']), 0, -1)) . '/';
$uri = substr($_SERVER['REQUEST_URI'], strlen($basepath));
if (strstr($uri, '?')) $uri = substr($uri, 0, strpos($uri, '?'));
$uri = '/' . trim($uri, '/');
return $uri;
}
//based on a uri passed in as a parameter, return an array of the routes contained in that uri
function getRoutes($uri)
{
$routes = Array();
$routes = explode("/", $uri);
$finalRoutes = Array();
foreach($routes as $route)
{
if($route != "")
$finalRoutes[] = $route;
}
return $finalRoutes;
}
?>