Commit 635819a57e859ecf5880611d2dd9178a6d64a97c
1 parent
bfaa212b
Fake mod rewrite
Weppes don't want to hear ModRewrite, 404 redirection doesn't work with dynamic JS, so I had to make those ... things.
Showing
8 changed files
with
14 additions
and
21 deletions
Show diff stats
.htaccess deleted
Makefile
index.php
... | ... | @@ -8,24 +8,16 @@ $path = $parsedUrl['path']; |
8 | 8 | $explodedUrl = explode('/', $path); |
9 | 9 | $page = end($explodedUrl); |
10 | 10 | |
11 | -switch ($page) { | |
12 | - case 'home': | |
13 | - case 'description': | |
14 | - case 'sponsors': | |
15 | - case 'schools': | |
16 | - case 'contact': | |
17 | - $toLoad = $page; | |
18 | - break; | |
19 | - case '': | |
20 | - $toLoad = 'home'; | |
21 | - break; | |
22 | - default: | |
23 | - $toLoad = '404'; | |
24 | - break; | |
11 | +if ($page == '') { | |
12 | + $page = 'home'; | |
25 | 13 | } |
26 | 14 | |
15 | +$toLoad = "pages/$page.php"; | |
16 | + | |
17 | +// TODO Test if exists, 404 otherwise | |
18 | + | |
27 | 19 | if (isset($_GET['c'])) { |
28 | - require_once("$toLoad.php"); | |
20 | + require_once("$toLoad"); | |
29 | 21 | } else { |
30 | 22 | ?> |
31 | 23 | <!DOCTYPE> |
... | ... | @@ -53,7 +45,7 @@ if (isset($_GET['c'])) { |
53 | 45 | <div class="col-md-12 center-block"> |
54 | 46 | <div class="col-md-12" id="mainContainer"> |
55 | 47 | <?php |
56 | - require_once("$toLoad.php"); | |
48 | + require_once("$toLoad"); | |
57 | 49 | ?> |
58 | 50 | </div> |
59 | 51 | </div> | ... | ... |
contact.php renamed to pages/contact.php
description.php renamed to pages/description.php
home.php renamed to pages/home.php
schools.php renamed to pages/schools.php
sponsors.php renamed to pages/sponsors.php