Author: maieulrouquette2@tele2.fr
Date: Tue Aug 1 13:13:11 2006
New Revision: 4355
Log:
simplification du code - toujour pas de multilingusime
ajout de lien rel et prev + classe css
Modified:
_plugins_/_squelettes_/pagination_avancee/inc/pagination_precedent_suivant.php
Modified: _plugins_/_squelettes_/pagination_avancee/inc/pagination_precedent_suivant.php
--- _plugins_/_squelettes_/pagination_avancee/inc/pagination_precedent_suivant.php (original)
+++ _plugins_/_squelettes_/pagination_avancee/inc/pagination_precedent_suivant.php Tue Aug 1 13:13:11 2006
@@ -2,35 +2,21 @@
function pagination_precedent_suivant($total, $nom, $pas, $liste){
static $ancres = array();
- $separateur=" | ";
-
-
-
-
-
$debut = 'debut'.$nom;
$ancre='pagination'.$nom;
- $pagination = array(
- 'lien_base' => self(),
- 'total' => $total,
- 'position' => intval(_request($debut)),
- 'pas' => $pas,
- 'nombre_pages' => floor(($total-1)/$pas)+1,
- 'page_courante' => floor(intval(_request($debut))/$pas)+1,
- 'lien_pagination' => '<a href="@url@">@item@</a>',
- 'lien_item_courant' => '<span class="on">@item@</span>'
- );
+ $lien_precedent = '<a href="@url@" rev="prev" class="pagination_precedent">@item@</a>';
+ $lien_suivant = '<a href="@url@" rel="next" class="pagination_suivant">@item@</a>';
// n'afficher l'ancre qu'une fois
if (!isset($ancres[$ancre]))
$bloc_ancre = $ancres[$ancre] = "<a name='$ancre' id='$ancre'></a>";
// Pas de pagination
- if ($pagination['nombre_pages']<=1)
+ if ($total<=1)
return '';
// liste = false : on ne veut que l'ancre
@@ -39,36 +25,33 @@
// liste = true : on retourne tout (ancre + bloc de navigation)
- list ($premiere, $derniere) = calcul_bornes_pagination(
- $pagination['nombre_pages'],
- $pagination['nombre_pages'],
- $pagination['page_courante']);
+
$texte = '';
$num=_request($debut);
- if ($pagination['page_courante']==$premiere){
+ if ($num<0+$pas){
$texte=pagination_item($num+$pas,
'<:pagination_suivant:>',
- $pagination['lien_pagination'],self(),$debut,$ancre);
+ $lien_suivant,self(),$debut,$ancre);
}
- else if ($pagination['page_courante']==$derniere){
+ else if ($num>=$total-1-$pas){
$texte=pagination_item($num-$pas,
'<:pagination_precedent:>',
- $pagination['lien_pagination'],self(),$debut,$ancre);
+ $lien_precedent,self(),$debut,$ancre);
}
else {
$texte=pagination_item($num-$pas,
'<:pagination_precedent:>',
- $pagination['lien_pagination'],self(),$debut,$ancre);
+ $lien_precedent,self(),$debut,$ancre);
$texte = $texte.pagination_item($num+$pas,
'<:pagination_suivant:>',
- $pagination['lien_pagination'],self(),$debut,$ancre);
+ $lien_suivant,self(),$debut,$ancre);
}