Création d'archives sur un tableau de données
Posté : 15 déc. 2008, 16:48
Bonjour à tous,
On rentre dans le vif du sujet, voici mon code :
Il y a donc une ligne par jour dans le tableau.
Je souhaite que chaque ligne avec les données correspondantes au mois se retrouve dans une arborescence.
+2008
++janvier
++février
++mars
etc.
Comment cela est possible ?
Je n'ai pas trouvé la fonction ou le moyen approprié.
Merci.
On rentre dans le vif du sujet, voici mon code :
Code : Tout sélectionner
<?php
$nom = isset($_GET['nom'])? $_GET['nom'] : '';
$type = $_GET['type'];
if(empty($type))
{
$type = "$nom";
}
$lignes = file("$nom");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Menu</title>
<style>
body {
font-family : Verdana,Arial;
background-color : #A8D3ED;
}
td {
font-family : Verdana,Arial;
font-size : 8pt;
}
a {
text-decoration : none;
}
</style>
</head>
<body>
<table border="1">
<CAPTION>Compteur</CAPTION>
<tbody>
<tr>
<th colspan="12" rowspan="1">Type : <?php echo $type?></th>
</tr>
<tr>
<th colspan="1" rowspan="2">date</th>
<th colspan="1" rowspan="2">total</th>
<th colspan="3" rowspan="1">A</th>
<th colspan="6" rowspan="1">I</th>
<th colspan="1" rowspan="2">E</th>
</tr>
<tr>
<th>T.A</th>
<th>E.P</th>
<th>E.T</th>
<th>T.I</th>
<th>E.Pa</th>
<th>E.Pr</th>
<th>E.D</th>
<th>E.C</th>
<th>E.T</th>
</tr>
<?php for ($i=0; $i<count($lignes); $i++)
{
$couleur_ligne = ($i % 2)? '#B8C8FE' : '#EEEEEE';
$statistiques = explode(" ",$lignes[$i]);
echo '<tr>';
for ($a=0; $a<count($statistiques); $a++)
{
echo '<td bgcolor="'.$couleur_ligne.'">'.$statistiques[$a].'</td>';
}
echo '</tr>';
}?>
</tbody>
</table>
<br />
<a href="export.php"><u>Exporter le tableau</u></a>
</body>
</html>Il y a donc une ligne par jour dans le tableau.
Je souhaite que chaque ligne avec les données correspondantes au mois se retrouve dans une arborescence.
+2008
++janvier
++février
++mars
etc.
Comment cela est possible ?
Je n'ai pas trouvé la fonction ou le moyen approprié.
Merci.