[ 140005 ]
[ 38.103.63.16 ]
Réalisation du site en PHP (partie 2)Etape 2 - Les liensNous allons maintenant, formater les liens qui vont nous appeler les différentes pages(rubriques). Ouvrez le fichier index.php, si ce n'est pas le cas, et modifiez ce qui suit :
<?php
error_reporting(E_ALL ^ E_NOTICE);
$page = $_GET['page'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>Mon premier site en PHP</title>
<meta http-equiv="Content-Style-Type" content="text/css">
</head>
<body style="font-family: Arial, sans-serif;font-size: 12px; color: #000000;">
<table width="600" align="center" valign="top" cellspacing="2" cellpadding="2" border="0">
<tr valign="middle">
<td width="600" height="90" colspan="2" bgcolor="#0068B4">
<div style="font-size: 24px; color: #FFFFFF;">Mon premier site en PHP</div>
</td>
</tr>
<tr valign="top">
<td width="120" height="350" rowspan="2" bgcolor="#606DB2">
<div style="font-size: 13px;"><b>MENU :</b><br>
<ul>
<li><a href="index.php?page=accueil"> Accueil</a></li>
<li><a href="index.php?page=rubrique1"> Rubrique 1</a></li>
<li><a href="index.php?page=rubrique2"> Rubrique 2</a></li>
<li><a href="index.php?page=rubrique3"> Rubrique 3</a></li>
<li><a href="index.php?page=rubrique4"> Rubrique 4</a></li>
</ul>
</div>
</td>
<td width="480" height="310" bgcolor="#AFD394">
<div>
<?php
if (file_exists("pages/$page.html") == TRUE)
{include("pages/$page.html");}
else
{include("pages/accueil.html");}
?>
</div>
</td>
</tr>
<tr valign="middle">
<td width="480" height="40" bgcolor="#CDBCA3">
<div>2005 Copyright by Moi</div>
</td>
</tr>
</table>
</body>
</html>
Explications : Prenons par exemple, <a href="index.php?page=accueil"> Accueil</a>.
Et ainsi de suite. Passons à l'étape suivante Suite du Cours |