Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style>
- .bloco_noticias {
- padding:0px 100px 100px 185px;
- margin:100px 100px 100px 100px;
- }
- </style>
- <div class="bloco_noticias">
- <h2>Noticias:</h2><br />
- <?
- include ("../load/conexao.php");
- $p = $_GET["p"];
- if(isset($p)) {
- $p = $p;
- } else {
- $p = 1;
- }
- $qnt = 2;
- $inicio = ($p*$qnt) - $qnt;
- $sql_select = "select * from noticias order by id_noticia limit $inicio, $qnt";
- $sql_query = mysql_query($sql_select);
- while($linha = mysql_fetch_array($sql_query)) {
- $titulo = $linha["titulo_noticia"];
- echo "<div>$titulo</div>";
- }
- echo "<br />";
- echo "<div>";
- $sql_select_all = "select * from noticias";
- $sql_query_all = mysql_query($sql_select_all);
- $total_registros = mysql_num_rows($sql_query_all);
- $pags = ceil($total_registros/$qnt);
- $max_links = 3;
- ?>
- <a href="?pg=noticias" onClick="carrega('paginas/noticias.php?acao=buscar_noticia&p=1', '#galeria'); return false;">Ultima Página</a>
- <?
- echo " | ";
- for($i = $p-$max_links; $i <= $p-1; $i++) {
- if($i <=0) {
- } else {
- ?>
- <a href="?pg=noticias" onClick="carrega('paginas/noticias.php?acao=buscar_noticia&p=<? echo "$i"; ?>', '#galeria'); return false;"><? echo "$i"; ?></a>
- <?
- }
- }
- echo $p." ";
- for($i = $p+1; $i <= $p+$max_links; $i++) {
- if($i > $pags) {
- } else {
- ?>
- <a href="?pg=noticias" onClick="carrega('paginas/noticias.php?acao=buscar_noticia&p=<? echo "$i"; ?>', '#galeria'); return false;"><? echo "$i"; ?></a>
- <?
- }
- }
- echo "| ";
- ?>
- <a href="?pg=noticias" onClick="carrega('paginas/noticias.php?acao=buscar_noticia&p=<? echo "$pags"; ?>', '#galeria'); return false;">Ultima Página</a>
- <?
- echo "</div>";
- ?>
- </div>
Add Comment
Please, Sign In to add comment