Commit bce0656792220df66390e3790385bfa0269e67ec

Authored by Geoffrey PREUD'HOMME
1 parent 5f0258d5

Static PHP navigation

Showing 3 changed files with 27 additions and 6 deletions   Show diff stats
.htaccess 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +RewriteEngine on
  2 +RewriteCond %{REQUEST_URI} !^.+(css|fonts|img|js).+$
  3 +RewriteRule ^.+$ index.php [L]
0 4 \ No newline at end of file
... ...
index.php
... ... @@ -26,7 +26,25 @@ require_once("creds.php");
26 26 <?php require_once("menu.php");?>
27 27 <div class="col-md-12 center-block">
28 28 <div class="col-md-12" id="mainContainer">
29   -<?php require_once("home.php");?>
  29 +<?php
  30 +$page = end(explode('/', $_SERVER["REQUEST_URI"]));
  31 +switch ($page) {
  32 + case 'home':
  33 + case 'description':
  34 + case 'sponsors':
  35 + case 'schools':
  36 + case 'contact':
  37 + $toLoad = $page;
  38 + break;
  39 + case '':
  40 + $toLoad = 'home';
  41 + break;
  42 + default:
  43 + $toLoad = '404';
  44 + break;
  45 +}
  46 +require_once("$toLoad.php");
  47 +?>
30 48 </div>
31 49 </div>
32 50 &nbsp;
... ...
menu.php
... ... @@ -2,19 +2,19 @@
2 2 <div class="container-fluid">
3 3 <ul class="nav navbar-nav">
4 4 <li>
5   - <a href="#home" onClick="loadNewDoc('home.php');">Accueil</a>
  5 + <a href="home">Accueil</a>
6 6 </li>
7 7 <li>
8   - <a href="#description" onClick="loadNewDoc('description.php');">Descritption</a>
  8 + <a href="description">Descritption</a>
9 9 </li>
10 10 <li>
11   - <a href="#sponsors" onClick="loadNewDoc('sponsors.php');">Sponsors</a>
  11 + <a href="sponsors">Sponsors</a>
12 12 </li>
13 13 <li>
14   - <a href="#schools" onClick="loadNewDoc('schools.phpDEBUG');">Ecoles participantes</a>
  14 + <a href="schools">Ecoles participantes</a>
15 15 </li>
16 16 <li>
17   - <a href="#contact" onClick="loadNewDoc('contact.php');">Contact</a>
  17 + <a href="contact">Contact</a>
18 18 </li>
19 19 </ul>
20 20 </div>
... ...