Quelque chose comme ça (en supposant que AdminSite.php est dans le même répertoire avec index.php):
<?php
$section = $_GET['section'];
if($section && $section == 'admin'){
include('AdminSite.php');
}
?>
Si vous allez faire à d'autres sections, il peut être quelque chose comme ceci:
<?php
$section = $_GET['section'];
if($section){
switch($section){
case 'admin':
include('AdminSite.php');
break;
case 'contacts':
include('Contacts.php');
break;
}
}
?>
Ou comme ceci:
<?php
$section = $_GET['section'];
$sections = [
'admin' => 'AdminSite.php',
'contacts' => 'Contacts.php',
// add your sections here
// 'section from url' => 'path to file'
];
if($section && file_exists($sections[$section])){
include($sections[$section]);
}
?>
Voulez-vous afficher AdminSite.php en tant que section dans index.php? Vous pouvez simplement l'inclure. –
@ chris85 Merci, ça marche: D – Deeonix