+++ /dev/null
-<?php
-
- if(!function_exists("mw_navig")) :
- function mw_navig($current, $total, $max, $base_url, $start_param, $legende = null)
- { $navig = "";
- if($max && $total > $max)
- { if(isset($legende))
- { $navig .=
- $legende." ".($current + 1)." à "
- .(($current + $max) > $total ? $total : $current + $max)
- ." sur ".$total." - aller à la ";
- }
- $get_params = array();
- if(($q = strpos($base_url, "?")) !== false)
- { $v_query = explode("&", substr($base_url, $q + 1));
- $base_url = substr($base_url, 0, $q);
- foreach($v_query as $query)
- { if($query)
- { $v = explode("=", $query);
- $get_params[$v[0]] = $v[1];
- }
- }
- }
- if(isset($get_params[$start_param])) unset($get_params[$start_param]);
- $base_url .= "?";
- foreach($get_params as $key => $value) $base_url .= $key."=".$value."&";
- $nb_pages = ceil($total / $max);
- $navig .=
- "page : "
- ."<select onchange=\"document.location=this.options[this.selectedIndex].value;\">\n";
- $np = 1;
- $ni = 0;
- while($ni < $total)
- { $navig .=
- " <option value=\"".$base_url.$start_param."=".$ni."\"".($current >= $ni && $current <= $ni ? " SELECTED" : "").">"
- .$np
- ."</option>\n";
- $np++;
- $ni += $max;
- }
- $navig .=
- "</select>\n";
- if($current >= $max)
- { $navig .=
- "<a href=\"".$base_url.$start_param."=".($current - $max)."\">«</a>\n";
- }
- if($current < $total - $max)
- { $navig .=
- "<a href=\"".$base_url.$start_param."=".($current + $max)."\">»</a>\n";
- }
- }
- return $navig;
- }
- endif;
-
-?>
\ No newline at end of file