Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 6th, 2018 67 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. //$rpp items por pagina
  2. //$count total de items
  3. $href page link
  4.  
  5. function pager($rpp, $count, $href, $opts = array()) {
  6.     $pages = ceil($count / $rpp);
  7.  
  8.     $pagedefault = 0;
  9.        
  10.     if (isset($_GET["page"])) {
  11.         $page = 0 + (int)$_GET["page"];
  12.         if ($page < 0)
  13.             $page = $pagedefault;
  14.     }
  15.     else
  16.         $page = $pagedefault;
  17.  
  18.     $pager = "";
  19.     $pager1 = "";
  20.  
  21.     $mp = $pages - 1;
  22.     $as = "&laquo;";
  23.     if ($page >= 1) {
  24.         $pager .= "<a href=\"{$href}page=" . ($page - 1) . "\">";
  25.         $pager .= $as;
  26.         $pager .= "</a>";
  27.     }
  28.     else
  29.         $pager .= "<span class=\"pagerso\">".$as."</span>";
  30.        
  31.     $as = "&raquo;";
  32.     if ($page < $mp && $mp >= 0) {
  33.         $pager1 .= "<a href=\"{$href}page=" . ($page + 1) . "\">";
  34.         $pager1 .= $as;
  35.         $pager1 .= "</a>";
  36.     }
  37.     else
  38.         $pager1 .= "<span class=\"pagerso\">".$as."</span>";
  39.  
  40.     if ($count) {
  41.         $pagerarr = array();
  42.         $dotted = 0;
  43.         $dotspace = 3; //links a mostrar
  44.         $dotend = $pages - $dotspace;
  45.         $curdotend = $page - $dotspace;
  46.         $curdotstart = $page + $dotspace;
  47.         for ($i = 0; $i < $pages; $i++) {
  48.             if (($i >= $dotspace && $i <= $curdotend) || ($i >= $curdotstart && $i < $dotend)) {
  49.                 if (!$dotted)
  50.                     $pagerarr[] = "<span class=\"extend\">...</span>";
  51.                 $dotted = 1;
  52.                 continue;
  53.             }
  54.             $dotted = 0;
  55.             $start = $i * $rpp + 1;
  56.             $end = $start + $rpp - 1;
  57.             if ($end > $count)
  58.                 $end = $count;
  59.             $text = "$start&nbsp;-&nbsp;$end";
  60.             if ($i != $page)
  61.                 $pagerarr[] = "<a href=\"{$href}page=$i\">$i</a>";
  62.             else
  63.                 $pagerarr[] = "<span class=\"current\">$i</span>";
  64.         }
  65.         $pagerstr = join(" ", $pagerarr);
  66.         $pagertop = "<div class=\"pager\">$pager $pagerstr $pager1</div>";
  67.         $pagerbottom = "<div class=\"pager\">$pager $pagerstr $pager1</div>";
  68.     }
  69.     else {
  70.         $pagertop = "";
  71.         $pagerbottom = $pagertop;
  72.     }
  73.  
  74.     $start = $page * $rpp;
  75.  
  76.     return array($pagertop, $pagerbottom, "LIMIT $start, $rpp");
  77. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top