Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/08/2014, 16:23
pilucho
 
Fecha de Ingreso: noviembre-2004
Ubicación: NULL
Mensajes: 652
Antigüedad: 19 años, 5 meses
Puntos: 6
Ordenar Paginacion PHP

Hola a todos y gracias por la visita a este post.
Tengo la siguiente paginacion que requiere ADODB Me funciona muy bien la paginacion, el problema es con los numeros por defecto tengo en 33 visibles, pero me gustaria reducir eso un ejemplo:

Actual:
««[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]»»

La idea es:
««[1][2][3][4][5][6][7][8][9][10]....[20][30][40][50][60]»»
al hacer clic en el ""[20]"" quede asi:
««[21][22][23][24][25][26][27][28][29][30]....[40][50][60][70][80]»»
Y si se fijan cambio de ....[20] a ....[40] y esto se incrementa segun el Nº de paginas:
espero me puedan ayudar, gracias.

Codigo
Código PHP:

<?
// Requiere ADODB
class pager
{
    var 
$row;
    var 
$pages;
    var 
$currentpage;
    var 
$limit//limit
    
var $numrows;
    var 
$first;
    var 
$last;
    function 
pager($conn$row$limit=10$getNumRowsSQL)
    {
        if (!isset(
$row)) $row 0;
        
$this->row $row;
        
$this->limit $limit;
        
$this->numrows $conn->GetOne($getNumRowsSQL);
        if ((
$this->numrows $this->limit) == 0$this->pages = ($this->numrows/$this->limit);
        else 
$this->pages intval($this->numrows/$this->limit) + 1;
        
$this->currentpage = ($this->row/$this->limit) + 1;
        
$this->first = ($this->row 1);
        if ((
$this->row $this->limit) >= $this->numrows$this->last $this->numrows; else $this->last = ($this->row $this->limit);
    }
    function 
getrecords($conn$sql$array=false)
    {
        
$recordSet = &$conn->SelectLimit($sql,$this->limit,$this->row);
        if (!
$array) return $recordSet;
        return 
$recordSet->getArray(); 
    }
    function 
showpagernav($backtext '&laquo;&laquo;'$nexttext '&raquo;&raquo;'$otherargs '')
    {
        if (
$this->pages 1)
        {
            echo 
'<div class="paginas-css"><table>';
            
// Enlace Atras
            
echo '<td>';
            if (
$this->row != 0
            {
                
$backPage $this->row $this->limit;  
echo 
"<a href=\"".$_SERVER['PHP_SELF']."?row=".$backPage.$otherargs."\">$backtext</a>"//     \n
            
}
            else echo 
'<li>&laquo;&laquo;</li>';
            echo 
'</td>';
            
// Enlace Paginas
            
echo '<td>';
    
//        for ($i=1; $i<=$this->pages; $i++) 
            
for ($i=1$i<=33$i++)  
//            for ($i=1; $i <= $this->pages; $i++) 
            
{  
                
$pages $this->limit*($i 1);
//                $ppage = $this->limit*($i - 1);                
                
if ($pages == $this->row)
                {
                    echo 
"<li class=\"active\"><b>$i</b></li>&nbsp;"// Espacio de los numeros de pagina
                
}
                else 
                {
echo 
"<a href=\"".$_SERVER['PHP_SELF']."?row=".$pages.$otherargs."\">$i</a>&nbsp;"// Espacio de los numeros de pagina
                
}
            }
            echo 
'</td>';
            
            
// Enlace Siguiente
              
if ($this->currentpage $this->pages
              { 
                  
$nextPage $this->row $this->limit;
             echo 
"<td><a href=\"".$_SERVER['PHP_SELF']."?row=".$nextPage.$otherargs."\">$nexttext</a></td>\n";
              }
            
            echo 
'</table></div>'// Cerrando el estilo de paginacion
        
}
        else echo 
"";
    }    
}
?>

Última edición por pilucho; 21/08/2014 a las 16:25 Razón: [