Paginação 10 numeros por página
Pessoal!
Tenho um script de paginação que está funcionando perfeitamente, porém preciso fazer uma mudança nele e não sei como:
segue abaixo o código:
<table width="893" border="0" align="center" bgcolor="#FFFFFF">
<tr>
<td><div align="center"><?php include ("pesquisa_noticias.php");?></div></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td width="890">
<font size="3" color="#000000"> </font>
<?php
// conexão com o banco de dados
include "Connections/conexao.php";
$newp = @$_GET["p"];if (!is_numeric ($newp)) {
$newp= 1;
}
$plimit = "12";// limite de linha para exibição
$strSQL = mysql_query("SELECT * FROM noticias order by dt_not desc"); // nome da tabela para que seja feito a contagem das linhas
$totalrows = mysql_num_rows($strSQL);
$pnums = ceil ($totalrows/$plimit);
if ($newp==''){ $newp='1'; }
$start = ($newp-1) * $plimit;
$starting_no = $start + 1;
if ($totalrows - $start < $plimit) { $end_count = $totalrows;
} elseif ($totalrows - $start >= $plimit) { $end_count = $start + $plimit; }
?>
<!-- Exibição dos Registros -->
<table width="900" height="135" border='0' >
<tr> </tr>
<?php
$strSQL = mysql_query("SELECT * FROM noticias order by dt_not desc LIMIT $start,$plimit");// SQL para exibição dos registros
while ($aux = mysql_fetch_array($strSQL)) {
$id = $aux["seq_not"];
$titulo = $aux["titulo_not"];
?>
<tr>
<td bgcolor="#FFFFFF">
<!-- Incio do Box 1-->
<div id="boxvd" align="center">
<?
$_dt_not= $aux['dt_not'];
list( $date, $time ) = explode( ' ', $_dt_not );
$data = explode("-",$date);
$_dt_not = "$data[2]/$data[1]/$data[0]";
?>
<font size='1' face='Verdana'><font color='#000000'><? echo $_dt_not; ?></font>
<a href='ver_noticias.php?id=<? echo $aux['seq_not']; ?>' rel="facebox">
<?
$img = $aux['img_1_not'];
if($img <> ""){
?>
<img src='painel/<? echo $aux['img_1_not']; ?>' width="115" height='90px' align='center' border="0">
<?
}else{
?>
<?
}
?>
</a>
<br>
<font size='1' face='Verdana'><font color='#000088'><b><a href='ver_noticias.php?id=<? echo $aux['seq_not']; ?>'><? echo $aux['titulo_not']; ?></a></font>
<br>
</div>
<!-- fim do box 1 --> </td>
<?
$aux = mysql_fetch_array($strSQL);
if ( $aux ) {
?>
<td bgcolor="#FFFFFF">
<!-- Incio do Box 2 -->
<div id="boxvd" align="center">
<?
$_dt_not= $aux['dt_not'];
list( $date, $time ) = explode( ' ', $_dt_not );
$data = explode("-",$date);
$_dt_not = "$data[2]/$data[1]/$data[0]";
?>
<font size='1' face='Verdana'><font color='#000000'><? echo $_dt_not; ?></font>
<a href='ver_noticias.php?id=<? echo $aux['seq_not']; ?>' rel="facebox">
<?
$img = $aux['img_1_not'];
if($img <> ""){
?>
<img src='painel/<? echo $aux['img_1_not']; ?>' width="115" height='90px' align='center' border="0">
<?
}else{
?><?
}
?>
</a>
<br>
<font size='1' face='Verdana'><font color='#000088'><b><a href='ver_noticias.php?id=<? echo $aux['seq_not']; ?>'><? echo $aux['titulo_not']; ?></a></font>
<br>
</div>
<!-- fim do box 2 --> </td>
<?
} else {
?>
<?
}
?>
<?
$aux = mysql_fetch_array($strSQL);
if ( $aux ) {
?>
<td bgcolor="#FFFFFF">
<!-- Incio do Box 3 -->
<div id="boxvd" align="center">
<?
$_dt_not= $aux['dt_not'];
list( $date, $time ) = explode( ' ', $_dt_not );
$data = explode("-",$date);
$_dt_not = "$data[2]/$data[1]/$data[0]";
?>
<font size='1' face='Verdana'><font color='#000000'><? echo $_dt_not; ?></font>
<a href='ver_noticias.php?id=<? echo $aux['seq_not']; ?>' rel="facebox">
<?
$img = $aux['img_1_not'];
if($img <> ""){
?>
<img src='painel/<? echo $aux['img_1_not']; ?>' width="115" height='90px' align='center' border="0">
<?
}else{
?><?
}
?>
</a>
<br>
<font size='1' face='Verdana'><font color='#000088'><b><a href='ver_noticias.php?id=<? echo $aux['seq_not']; ?>'><? echo $aux['titulo_not']; ?></a></font>
<br>
</div>
<!-- fim do box 3 --> </td>
<?
} else {
?>
<?
}
?>
<?
$aux = mysql_fetch_array($strSQL);
if ( $aux ) {
?>
<td bgcolor="#FFFFFF">
<!-- Incio do Box 4 -->
<div id="boxvd" align="center">
<?
$_dt_not= $aux['dt_not'];
list( $date, $time ) = explode( ' ', $_dt_not );
$data = explode("-",$date);
$_dt_not = "$data[2]/$data[1]/$data[0]";
?>
<font size='1' face='Verdana'><font color='#000000'><? echo $_dt_not; ?></font>
<a href='ver_noticias.php?id=<? echo $aux['seq_not']; ?>' rel="facebox">
<?
$img = $aux['img_1_not'];
if($img <> ""){
?>
<img src='painel/<? echo $aux['img_1_not']; ?>' width="115" height='90px' align='center' border="0">
<?
}else{
?><?
}
?>
</a>
<br>
<font size='1' face='Verdana'><font color='#000088'><b><a href='ver_noticias.php?id=<? echo $aux['seq_not']; ?>'><? echo $aux['titulo_not']; ?></a></font>
<br>
</div>
<!-- fim do box 4 --> </td>
<?
} else {
?>
<?
}
?>
</tr>
<?php
}
?>
</table>
<?php
//Aqui ira exibir a paginação
if ($totalrows - $end_count > $plimit) { $var2 = $plimit;
} elseif ($totalrows - $end_count <= $plimit) { $var2 = $totalrows - $end_count; }
?>
<div class='digg'>
<p>
<p>
<?php if ($newp>1) { ?>
<a href="<?php echo "noticias.php?p=".($newp-1);?>">«</a>
<?php } for ($i=1; $i<=$pnums; $i++) { if ($i!=$newp){ ?>
<a href="<?php echo "noticias.php?p=$i";?>"><?php print_r("$i");?></a>
<?php } else { ?>
<span class='current'><?php print_r("$i");?></span>
<?php }} if ($newp<$pnums) { ?>
<a href="<?php echo "noticias.php?p=".($newp+1);?>" class='next'>»</a>
<?php } ?>
<p>
<p></div>
<!-- fim da class digg --> </td>
</tr>
</table>
O script acima lista 12 noticias por página e lista o numero de páginas com a seguinte numeração.
« | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | »
Gostaria que ficasse assim:
Contendo 120 registros cada página com 10 então 12 páginas:
página 01
« | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | »
página 02
« | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | »
Agradeço a ajuda.
Discussão (2)
Carregando comentários...