Quantcast
Channel: Últimos conteúdos
Viewing all articles
Browse latest Browse all 14190

Problemas com paginação.

$
0
0

Pessoal, bom dia. Estou com um problema em relação a paginação.

 

Quando eu chego na ultima página, o restante do site some.

 

Vejam o exemplo abaixo:

 

http://clickslim.com.br/comrodape.jpg => Página 4 da paginação, Está ainda está com o rodapé.

 

http://clickslim.com.br/semrodape.jpg => Página 5 da paginação, O rodapé sumiu.

 

as noticias estão na section descrita no código abaixo.

<section id="ultimas-noticias">
    	<div class="interface">
        	<?php 
			$page = 0;
			$alb = 3;
			$current = 1;
			$link = '';
			if ( isset( $_GET['page'] ) )
			{
				$current = $_GET['page'];
				$page = $alb * $_GET['page'] - $alb;
				if ( $_GET['page'] == 1 )
				{
					$page = 0;
				}
			}
				$noticia = mysql_query( "SELECT * FROM noticias INNER JOIN categorias ON (noticias.categoria = categorias.id_categoria) WHERE status='1' ORDER BY id_noticia DESC" );
				$total = mysql_num_rows($noticia);
					if ( $total > $alb )
					{				
						$link = "<ul class=\"paginacao\" style=\"float:left; width:99%;\">\n";
						$prox = "javascript:;";
						$ant = "javascript:;";
						if ( $current >= 2 )
						{
							$ant = "index.php?page=" . ($current - 1);
						}
						if ( $current >= 1 && $current < ($total / $alb))
						{
							$prox = "index.php?page=" . ($current + 1);
						}
						$link .= '<li><a href="' . $ant . '" title="Anterior"><img src="../imagens/prev.png" alt="Anterior" /></a></li>';
						$from = round( $total / $alb ) ;
						if($from == 1){$from++;}			
						for ( $i = 1; $i <= $from; $i++ )
						{
							if ( $current == $i )
							{
								$link .= "<li><a class=\"current\" href=\"index.php?page=$i\"><b>$i</b></a></li>\n";
							}
							else
							{
								$link .= "<li><a href=\"index.php?page=$i\"><b>$i</b></a></li>\n";
							}
						}
						$link .= '<li><a href="' . $prox . '" title="Próxima"><img src="../imagens/next.png" alt="Próxima" /></a></li>';
						$link .= "</ul>\n";
					}
					$noticias = mysql_query("SELECT * FROM noticias INNER JOIN categorias ON (noticias.categoria = categorias.id_categoria) WHERE status='1' ORDER BY id_noticia DESC LIMIT $page, $alb");
					$total_noticias = mysql_num_rows($noticias);
				
				while($nt = mysql_fetch_array($noticias)){
					$data = explode("-", $nt["dataPub"]);
					$dataEx = $data[2]."/".$data[1]."/".$data[0];
			?>
            <section class="noticia">
                <a href="noticia.php?id=<?php echo $nt['id_noticia']; ?>" class="img-noticia"><img src="paineldecontrole/imagens/imgnoticia/<?php echo $nt['imagem']; ?>" alt="<?php echo $nt["titulo"]; ?>" /></a>
                <span class="data-hora"><?php echo $dataEx; ?> - <?php echo $nt['horaPub']; ?></span>
                <h1 class="titulo-noticia"><a href="noticia.php?id=<?php echo $nt['id_noticia']; ?>"><?php echo $nt["titulo"]; ?></a></h1>
                <div class="resumo">
                	<?php echo substr($nt["conteudo"], 0, 880)."[...]"; ?>
                </div>
            </section>
            <?php
				}
				
				echo $link;
			?>
        </div>
    </section>
    <?php require_once '../includes/footer.php'; ?>

Viewing all articles
Browse latest Browse all 14190