Guest User

Untitled

a guest
Jun 24th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. <style>
  2. .bloco_noticias {
  3. padding:0px 100px 100px 185px;
  4. margin:100px 100px 100px 100px;
  5. }
  6. </style>
  7. <div class="bloco_noticias">
  8. <h2>Noticias:</h2><br />
  9. <?
  10.  
  11. include ("../load/conexao.php");
  12. $p = $_GET["p"];
  13. if(isset($p)) {
  14. $p = $p;
  15. } else {
  16. $p = 1;
  17. }
  18. $qnt = 2;
  19. $inicio = ($p*$qnt) - $qnt;
  20. $sql_select = "select * from noticias order by id_noticia limit $inicio, $qnt";
  21. $sql_query = mysql_query($sql_select);
  22. while($linha = mysql_fetch_array($sql_query)) {
  23. $titulo = $linha["titulo_noticia"];
  24. echo "<div>$titulo</div>";
  25. }
  26. echo "<br />";
  27. echo "<div>";
  28. $sql_select_all = "select * from noticias";
  29. $sql_query_all = mysql_query($sql_select_all);
  30. $total_registros = mysql_num_rows($sql_query_all);
  31. $pags = ceil($total_registros/$qnt);
  32. $max_links = 3;
  33. ?>
  34. <a href="?pg=noticias" onClick="carrega('paginas/noticias.php?acao=buscar_noticia&p=1', '#galeria'); return false;">Ultima P&aacute;gina</a>
  35. <?
  36. echo "&nbsp;|&nbsp;";
  37. for($i = $p-$max_links; $i <= $p-1; $i++) {
  38. if($i <=0) {
  39. } else {
  40. ?>
  41. <a href="?pg=noticias" onClick="carrega('paginas/noticias.php?acao=buscar_noticia&p=<? echo "$i"; ?>', '#galeria'); return false;"><? echo "$i"; ?></a>
  42. <?
  43. }
  44. }
  45. echo $p." ";
  46. for($i = $p+1; $i <= $p+$max_links; $i++) {
  47. if($i > $pags) {
  48. } else {
  49. ?>
  50. <a href="?pg=noticias" onClick="carrega('paginas/noticias.php?acao=buscar_noticia&p=<? echo "$i"; ?>', '#galeria'); return false;"><? echo "$i"; ?></a>
  51. <?
  52. }
  53. }
  54. echo "|&nbsp;";
  55. ?>
  56. <a href="?pg=noticias" onClick="carrega('paginas/noticias.php?acao=buscar_noticia&p=<? echo "$pags"; ?>', '#galeria'); return false;">Ultima P&aacute;gina</a>
  57.  
  58. <?
  59. echo "</div>";
  60. ?>
  61. </div>
Add Comment
Please, Sign In to add comment