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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
| <table width="100%" cellpadding="5" cellspacing="5" >
<tr>
<td align="left"><div class="titre"><u>Les Docs </u></div></td>
</tr>
<tr>
<td align="left"><table width="100%" >
<tr>
<td>Documents : </td>
<td width="200" align="right"> </td>
</tr>
<tr>
<td> </td>
<td align="right"> </td>
</tr>
</table>
<?
$Nmax = 5; // nombre par page
$Ncur = -2; // n° de la fiche courante
$Ndeb=@$_GET["num"]; // 1ère fiche transmise par l'URL
$PATH = '../docs/';// Listage d'un répertoire $PATH
if ($dir = @opendir($PATH)) {// ouverture du dossier
while (($file = readdir($dir)) && ($Ncur<$Nmax+$Ndeb)) {
if($Ncur>=$Ndeb) { // lecture d'une entrée
//création d'un tableau à 2 colonnes : nom + date fichiers
if ($file!=='.' && $file!=='..'){
$tab[] = array($file); }}
// une de plus
$Ncur++;
// sauvegarde du nom du fichier et de sa date
}
closedir($dir); // fermeture du dossier
}
usort($tab);
foreach($tab as $elem) {
//formatage de la date avec mktime() selon le format retourné par filemtime()
require_once("../docs/$elem[0]");
echo "<table width='100%' cellpadding='5'>";
echo "<tr>";
echo "<td width='25%' rowspan='3' align='center'>".$image."</td>";
echo "<td colspan='2' class='titre'>".$titre."</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='2'>".$description."</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='42%'> </td>";
echo "<td width='33%'><div align='center'><a href='index.php?page=down'>Télécharger</a></div></td>";
echo "</tr>";
echo "</table>";
}
?>
<table width="100%" >
<tr>
<td> </td>
<td align="right"> </td>
</tr>
<tr>
<td> </td>
<td width="200" align="right">
<table cellpadding=3><tr>
<?
// Navigation
// Des fiches avant ?
if($Ndeb > 0) { ?>
<td>
<A href="?num=<? echo $Ndeb-$Nmax; ?>"
>Retour</A>
</td>
<? }
// Des fiches après ?
if($file) { ?>
<td>
<A href="?num=<? echo $Ncur; ?>">Suite</A>
</td>
<? } ?>
</tr></table>
</td>
</tr>
</table></td>
</tr>
</table> |
Partager