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
| <?php
// Tableau des fichiers à importer
$arrayPages = array
(
'accueil' => 'accueil.php',
'beaute_mains_pieds' => 'beaute_mains_pieds.php',
'beaute_regard' => 'beaute_regard.php',
'epilations' => 'epilations.php',
'modelages' => 'modelages.php',
'soins_du_corps' => 'soins_du_corps.php',
'tarifs' => 'tarifs.php',
'contact' => 'contact.php',
'avantages' => 'avantages.php',
);
// La variable $page existe-elle dans l'url ?
if(!empty($_GET['page']))
{
// Vérification de la valeur passée dans l'url : est-elle une clé du tableau ?
if(array_key_exists(strtolower($_GET['page']), $arrayPages))
{
// Oui, alors on l'importe
include('pages/'. $arrayPages[ strtolower($_GET['page']) ] );
}
else
{
// Non, alors on importe un fichier par défaut
include('pages/erreur-404.php');
}
}
else
{
// Non, on affiche la page d'accueil par défaut
include('pages/'. $arrayPages['accueil']);
}
?> |
Partager