Ver Mensaje Individual
  #6 (permalink)  
Antiguo 24/07/2012, 16:26
Avatar de informacionsys
informacionsys
 
Fecha de Ingreso: mayo-2011
Ubicación: Bogota D.C
Mensajes: 793
Antigüedad: 13 años, 9 meses
Puntos: 76
Respuesta: Paginacion PHP - SQL SERVER

hola

mmmmm si eso fue hace mucho tiempo jeje... pero al fin lo solucione


Código PHP:
Ver original
  1. function paginacionSQL($actual, $total, $por_pagina, $enlace,$maxpags=0) {
  2. $total_paginas = ceil($total/$por_pagina);
  3. $anterior = $actual - 1;
  4. $posterior = $actual + 1;
  5. $minimo = $maxpags ? max(1, $actual-ceil($maxpags/2)): 1;
  6. $maximo = $maxpags ? min($total_paginas, $actual+floor($maxpags/2)): $total_paginas;
  7. if ($actual>1)
  8. $texto = "<a href=\"".$enlace."?pag=".$anterior."\">«</a> ";
  9. else
  10. $texto = "<b>«</b> ";
  11. if ($minimo!=1) $texto.= "... ";
  12. for ($i=$minimo; $i<$actual; $i++)
  13. $texto .= "<a href=\"".$enlace."?pag=".$i."\">$i</a> ";
  14. $texto .= "<b>$actual</b> ";
  15. for ($i=$actual+1; $i<=$maximo; $i++)
  16. $texto .= "<a href=\"".$enlace."?pag=".$i."\">$i</a> ";
  17. if ($maximo!=$total_paginas) $texto.= "... ";
  18. if ($actual<$total_paginas)
  19. $texto .= "<a href=\"".$enlace."?pag=".$posterior."\">»</a>";
  20. else
  21. $texto .= "<b>»</b>";
  22. return $texto;
  23. }