[ Index ] |
|
Code source de SPIP Agora 1.4 |
1 <?php 2 3 // Auteur: robert.sebille(at)cassiopea.org - sept 2003 4 // Sous licence GNU/GPL http://www.gnu.org/copyleft/gpl.html 5 // Retourne les liens XX articles suivants / précédents 6 7 8 // Gestion des n° de pages 9 $mod0 = $total % $nb_art_par_page; 10 if ($mod0 == 0) 11 {$total_page = floor($total / $nb_art_par_page);} 12 else 13 {$total_page = floor($total / $nb_art_par_page) + 1;} 14 15 $page = floor($compteur / $nb_art_par_page); 16 $page_inv = $total_page - $page + 1; 17 18 if ($mod0 !=0 && ($total - $compteur) < $mod0) 19 {$page = $total_page; $page_inv = 1; $offset_art_prec = $total - $mod0 - $nb_art_par_page;} 20 else 21 {$offset_art_prec = $compteur - (2 * $nb_art_par_page);} 22 23 24 // Gestion de l'affichage des liens 25 // fleche gauche 26 if ($total_page > 1) { 27 $affiche = ""; $pageplus_inv = $page_inv + 1; $pagemoins_inv = $page_inv - 1; 28 if ($offset_art_prec >= 0) 29 {$affiche .= "<a href='$type.php?id_$type=$idtype&debut_article=$offset_art_prec' title='Les ".$nb_art_par_page." articles suivants'><img src='NAVPICS/fleche-gauche.gif' width='15' height='9' alt='Vers la page ".$pageplus_inv." et les ".$nb_art_par_page." articles suivants' border='0'></a> ";} 30 31 // Milieu 32 $affiche .= "Page(s):"; 33 34 $MaxPageLinks = 10; 35 if ($total_page - ($MaxPageLinks - 1) > $page_inv) 36 {$PageStart = $page_inv + ($MaxPageLinks - 1);} else {$PageStart = $total_page;} 37 if ($PageStart - ($MaxPageLinks -1) < 1) 38 {$PageEnd = 1;} else {$PageEnd = $PageStart - ($MaxPageLinks - 1);} 39 40 for ($i = $PageStart; $i >= $PageEnd; $i--) { 41 $offset_inv = ($nb_art_par_page * $total_page) - ($i * $nb_art_par_page); 42 if ($i != $page_inv) 43 {$affiche .= " <a href='$type.php?id_$type=$idtype&debut_article=$offset_inv'> $i </a>";} 44 else 45 {$affiche .= " | $i |";} 46 } // End ($i = $PageStart; $i >= $PageEnd; $i--) 47 48 // fleche droite 49 if ($compteur < $total) 50 {if (($compteur+$nb_art_par_page) > $total) {$nb_art_suiv = $total - $compteur;} else {$nb_art_suiv = $nb_art_par_page;} 51 $affiche .= " <a href='$type.php?id_$type=$idtype&debut_article=$compteur' title='Les ".$nb_art_suiv." articles précédents'><img src='NAVPICS/fleche-droite.gif' width='15' height='9' alt='Vers la page ".$pagemoins_inv." et les ".$nb_art_suiv." articles précédents' border='0'></a>";} 52 53 // Dessous 54 $affiche .= "<br>Nombre total de page(s): $total_page"; 55 56 } // End if ($total_page > 1) 57 58 echo $affiche; 59 60 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |