Jump to content


Photo

Problema Paginação de Noticia

paginação noticia portal

  • Faça o login para participar
7 replies to this topic

#1 luizinhomt

luizinhomt

    Novato no fórum

  • Usuários
  • 1 posts
  • Sexo:Masculino

Posted 20/03/2015, 00:26

baixei um portal resolvir todos os outros bug mais , esse ta fods .

 

Enfim

 

Quando Coloco nas Noticias lista tudo certinho , pagina 1 com 10 noticias mais quando coloco na pagina 2 que deveria pega a noticia da 11 a 20 , continua na pagina 1 com as mesmas noticias !

 

o link muda fica meu link/noticias?pg=2 mais continua as mesma noticia e na pagina 1

 

 

aqui estar a paginação acho que o erro na estar ai



<table border="0" align="right" cellpadding="0" cellspacing="0">



  <tr>

    <td align="center"><p>&nbsp;  </p>

	

	

<table border="0" cellpadding="2" cellspacing="1">

<tr>

	<? 





for($i=1; $i<$page; $i++)

if($i>=$page-5)



echo "<td width='12' align='center' style='border:1px solid $Cor1'><a href='?page=$i'><b><font color='#1E4B7A'>$i</font></b></a></td>";

echo "<td width='12' align='center' style='border:1px solid $Cor1; color:#FFF' bgcolor='#1E4B7A'><b>$page</b></td>";



for($i=$page+1; $i<=$tp; $i++)

if($i<=$page+5)



echo "<td width='12' align='center' style='border:1px solid $Cor1;'><a href='?page=$i'><b><font color='#1E4B7A'>$i</font></b></a></td>";



?>

</tr>

</table>



</td>

</tr>

</table>

aqui estar a parte de exibição problema deve estar ai !

$variables=(strtolower($_SERVER['REQUEST_METHOD'])== 'GET') ? $_GET : $_POST;

foreach ($variables as $k=> $v)

$$k=$v;



$tabela1 = "tb_noticias";

$tabela2 = "users";

$tabela3 = "cidades";

 

$file = "$tabela1";





// INICIO DA ACAO DE EXIBIR









// INICIO DA ACAO VER ULTIMAS

if($acao == "ultimas_noticia"){

	

	

	if(!empty($limite2)){

	$limite2 = "LIMIT $limite2";

	}



$busca = "SELECT * FROM $tabela1 WHERE status='S' AND id_cat='$id' $ordem ";

//echo $busca;



	if($paginacao == "S"){

	

		$total_reg = $qts_ultimos; ;

	

		if(!$page){

		$page = "1";

		}



		$inicio = $page-1;

		$inicio = $inicio*$total_reg;

		$limite = mysql_query("$busca LIMIT $inicio,$total_reg");

	} else {

		$limite = mysql_query("$busca $limite2");

	} 



$todos = mysql_query("$busca");



$tr = mysql_num_rows($todos);



$tp = @ceil($tr / $total_reg);



if($tr > 0){

?>



<table border="0" cellpadding="1" cellspacing="0">

  <?

// Agora vamos montar o c&oacute;digo. Pegue o valor total de resultados: 

$total = mysql_num_rows($limite); 

// Defina o n&uacute;mero de colunas que voc&ecirc; deseja exibir: 

//$colunas = "3"; 

//$colunas = "$qts_colunas"; 

// Agora vamos ao "truque": 

if ($total>0) { 

for ($i = 0; $i < $total; $i++) { 

if (($i%$colunas)==0) { 



$colspan = $colunas+$colunas+$colunas;

?>

  <tr>

    <? }?>

    <?

$dados = mysql_fetch_array($limite) ;



?>

    <td align="center" valign="top"><table border="0" cellpadding="0" cellspacing="0" onmouseover="this.style.backgroundColor='#E4EAED';" onmouseout="this.style.backgroundColor='#F7F7F7';">

    <tr>

	   	   <td width="<?=$largura_coluna?>" align="right" valign="middle"><table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">

            <tr>

            <? if(!empty($dados[foto])){?>

<td width="94px" height="<?=$altura+10;?>" align="left" valign="top">



<table border="0" cellpadding="1" cellspacing="0" width="94px" >

  <tr>

  

    <td><table border="0" cellspacing="0" cellpadding="1" width="92px">

            <tr>

              <td><a href='<?="/noticia/$dados[id]";?>-<?= str_replace(" ","_",$dados['titulo']); ?>.html' class="img_borda"><img src="<?="/thumbs.php?w=$largura&h=$altura&imagem=images/noticias/$dados[id]/$dados[foto]";?>" width="<?=$largura?>" height="<?=$altura?>" border="0" style="FILTER: alpha(opacity=100);" onMouseOver="makevisible(this,0)" onMouseOut="makevisible(this,1)"></a></td>

            </tr>

          </table></td>

  </tr>

</table></td>

<? }?>



<td align="right" valign="middle">

<? if($exibir_cat=="S"){?>

<table width="100%" border="0" cellpadding="1" cellspacing="0">

  <tr><td bgcolor="<?=$corcelula2?>">&nbsp;&nbsp;<?

$dados2 = mysql_fetch_array(mysql_query("SELECT * FROM tb_noticias_cat WHERE id='$dados[id_cat]'"));

echo "<font size='2' color='#18509E'><b>$dados2[nome]</b></font>";	

?></td>

  </tr>

  <tr>

    <td height="3"></td>

  </tr>

</table>

<? }?>

<table width="98%" border="0" cellpadding="0" cellspacing="0">

  <tr>

    <td>		  

<a href='<?="/noticia/$dados[id]";?>-<?= str_replace(" ","_",$dados['titulo']); ?>.html' class="noticiadestaque2">

<?

	echo strftime("<font class='datadestaque2'>'%d de %B de %Y'</font>", strtotime($dados[data]))."<br>";



	$contatamanho1 = strlen($dados[titulo]);

	if($contatamanho1 > $qt_letras1){

	$titulo = substr_replace($dados[titulo], "...", $qt_letras1, $contatamanho1 - $qt_letras1);

	} else {

	$titulo = $dados[titulo];

	}

		$contatamanho2 = strlen($dados[subtitulo]);

		if($contatamanho2 > $qt_letras2){

		$subtitulo = substr_replace($dados[subtitulo], "...", $qt_letras2, $contatamanho2 - $qt_letras2);

		} else {

		$subtitulo = $dados[subtitulo];

		}

	

	echo "<font size='4' color='#18509E'>$titulo</font><br>";

		echo "<font size='1' color='#333333'>$subtitulo</font><br>";	

	

echo "</a>";	

?></td>

  </tr>

</table>

</td>

</tr>

		

</table></td>

        



        

      </tr>

      <tr><td height="2" colspan="4"></td></tr>

 	  <tr><td colspan="4" height="1" bgcolor="<?=$corcelula2?>"></td></tr>

      <tr><td height="2" colspan="4"></td></tr>

    </table></td>

    <? }?>

  </TR>

  <? }?>

</table>

<?

// INICIO DA PAGINAÇÃO

if($paginacao == "S"){

	include "paginas/paginacao.php";

}

// FIM DA PAGINAÇÃO

?>





<? } else {?>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td align="center"><br />

nenhum <b>registro</b><b> </b>encontrado!<br />

<br />

</td>

  </tr>

</table>

<?

} // FIM DO ELSE

} // FIM DA ACAO VER ULTIMAS

?>  

<?

if($acao == "ver_todas"){



	

	if(!empty($limite2)){

	$limite2 = "LIMIT $limite2";

	}



$busca = "SELECT * FROM $tabela1 WHERE status='S' $ordem";

//echo $busca;



	if($paginacao == "S"){

	

		$total_reg = "10";

	

		if(!$page){

		$page = "1";

		}



		$inicio = $page-1;

		$inicio = $inicio*$total_reg;

		$limite = mysql_query("$busca LIMIT $inicio,$total_reg");

	} else {

		$limite = mysql_query("$busca $limite2");

	} 



$todos = mysql_query("$busca");



$tr = mysql_num_rows($todos);



$tp = @ceil($tr / $total_reg);



if($tr > 0){

?>



<table border="0" cellpadding="1" cellspacing="0">

  <?

// Agora vamos montar o c&oacute;digo. Pegue o valor total de resultados: 

$total = mysql_num_rows($limite); 

// Defina o n&uacute;mero de colunas que voc&ecirc; deseja exibir: 

//$colunas = "3"; 

//$colunas = "$qts_colunas"; 

// Agora vamos ao "truque": 

if ($total>0) { 

for ($i = 0; $i < $total; $i++) { 

if (($i%$colunas)==0) { 



$colspan = $colunas+$colunas+$colunas;

?>

  <tr>

    <? }?>

    <?

$dados = mysql_fetch_array($limite) ;



?>

    <td align="center" valign="top"><table border="0" cellpadding="0" cellspacing="0">

    <tr>

	   	   <td width="<?=$largura_coluna?>" align="right" valign="middle"><table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">

            <tr>

            <? if(!empty($dados[foto])){?>

<td width="94px" height="<?=$altura+10;?>" align="left" valign="top">



<table border="0" cellpadding="1" cellspacing="0" width="94px" >

  <tr>

  

    <td><table border="0" cellspacing="0" cellpadding="1" width="92px">

            <tr>

              <td><a href='<?="/noticia/$dados[id]";?>-<?= str_replace(" ","_",$dados['titulo']); ?>.html' class="img_borda"><img src="<?="/thumbs.php?w=$largura&h=$altura&imagem=images/noticias/$dados[id]/$dados[foto]";?>" width="<?=$largura?>" height="<?=$altura?>" border="0" style="FILTER: alpha(opacity=100);" onMouseOver="makevisible(this,0)" onMouseOut="makevisible(this,1)"></a></td>

            </tr>

          </table></td>

  </tr>

</table></td>

<? }?>



<td align="right" valign="middle">

<? if($exibir_cat=="S"){?>

<table width="100%" border="0" cellpadding="1" cellspacing="0">

  <tr><td bgcolor="<?=$corcelula2?>">&nbsp;&nbsp;<?

$dados2 = mysql_fetch_array(mysql_query("SELECT * FROM tb_noticias_cat WHERE id='$dados[id_cat]'"));

echo "<font size='2' color='#C9168E' face='Trebuchet MS'><b>$dados2[nome]</b></font> - ";	echo strftime("<font size='2' face='Trebuchet MS' color='#18509E'>%d de %B de %Y</font>", strtotime($dados[data]));

?></td>

  </tr>

  <tr>

    <td height="3"></td>

  </tr>

</table>

<? }?>

<table width="98%" border="0" cellpadding="0" cellspacing="0">

  <tr>

    <td>		  

<a href='<?="/noticia/$dados[id]";?>-<?= str_replace(" ","_",$dados['titulo']); ?>.html' class="noticiadestaque2">

<?

	

	$contatamanho1 = strlen($dados[titulo]);

	if($contatamanho1 > $qt_letras1){

	$titulo = substr_replace($dados[titulo], "...", $qt_letras1, $contatamanho1 - $qt_letras1);

	} else {

	$titulo = $dados[titulo];

	}

		$contatamanho2 = strlen($dados[subtitulo]);

		if($contatamanho2 > $qt_letras2){

		$subtitulo = substr_replace($dados[subtitulo], "...", $qt_letras2, $contatamanho2 - $qt_letras2);

		} else {

		$subtitulo = $dados[subtitulo];

		}

	

	echo "$titulo<br>";

		echo "<font size='1' color='#333333'>$subtitulo</font><br>";	

	

echo "</a>";	

?></td>

  </tr>

</table>

</td>

</tr>

		

</table></td>

        



        

      </tr>

      <tr><td height="2" colspan="4"></td></tr>

 	  <tr><td colspan="4" height="1" bgcolor="<?=$corcelula2?>"></td></tr>

      <tr><td height="2" colspan="4"></td></tr>

    </table></td>

    <? }?>

  </TR>

  <? }?>

</table>

<?

// INICIO DA PAGINAÇÃO

if($paginacao == "S"){

	include "paginas/paginacao.php";

}

// FIM DA PAGINAÇÃO

?>





<? } else {?>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td align="center"><br />

nenhum <b>registro</b><b> </b>encontrado!<br />

<br />

</td>

  </tr>

</table>

<?

} // FIM DO ELSE

} // FIM DA ACAO VER ULTIMAS

agradeço a todos espero que alguem ai possa me ajudar


Edição feita por: luizinhomt, 20/03/2015, 00:38.


#2 Kumaiti

Kumaiti

    Normal

  • Usuários
  • 77 posts
  • Sexo:Masculino
  • Localidade:São Paulo

Posted 20/03/2015, 13:03

Meu nível de PHP não é suficiente para responder sua pergunta, mas aqui vai uma dica: se ninguém responde o tópico é talvez pq nao tenha tido visibilidade suficiente. 

 

Compartilhar o tópico em redes sociais muitas vezes ajuda bastante. 



#3 ximnes

ximnes

    Novato no fórum

  • Usuários
  • 3 posts
  • Sexo:Masculino
  • Localidade:Petrópolis RJ

Posted 23/04/2015, 02:59

Não tenho certeza meu amigo, porém esta parte aqui não era pra estar fora dos comentários "//"?

 

  1.  
  2. // Defina o n&uacute;mero de colunas que voc&ecirc; deseja exibir:
  3.  
  4. //$colunas = "3";
  5.  
  6. //$colunas = "$qts_colunas";
  7.  
  8. // Agora vamos ao "truque":
  9.  


#4 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 14/10/2017, 11:17

Amoxicillin 850 Mg Side Effects buy viagra Want to buy isotretinoin us free shipping
Lasix Compresse viagra Canadian Ed Meds
Levitra Vom Arzt Verschreiben Lassen levitra soft tabs Propranolol Canada Viagra Generique En Ligne
Wellbutrin Xl 150 Buy online pharmacy Was Ist Viagra Effekt Viagra Levitra Prezzo
Chinese Herbal Viagra viagra isotretinoin worldwide no rx by money order Pharmacycustomercare Cytotec Pregnancy

#5 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 14/10/2017, 16:51

Cialis Alkohol Forum Viagra With Dapoxetine Reviews Allegra Doxycycline Keflex Nexium Together viagra Rx Pills
Cheap Online Cialis For Sale Discount Generic Acticin Real Site Fiable Pour Achat Kamagra cialis Cytotec 200 Pour Ivg No Prescription 3 Mg Estradiol Pills
Male Amoxicillin Genital Tract Cheapest Levitra Online Uk Keflex For Broncitis viagra Medicina Online Propecia

#6 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 14/10/2017, 18:16

Misoprostol Cytotec Ou Acheter Du Viagra Forum Amoxicillin Upper Respiratory Tract Infection cialis Viagra Zollfrei Deutschland

#7 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 14/10/2017, 19:13

Cialis Euros viagra Generic Free Shipping Clobetasol 0.05% Psoriasis Le Cialis Generique Buy Revatio Online
Levitra Mujer Clomid Liqua Tech Labs Comprar Cialis En Malaga cialis Cialis Pas Cher Livraison Rapide Cialis Once Daily 5mg Best Price
Cialis Achat Ligne Viagra Cuando Se Debe Tomar Viagra In Wiesbaden Kaufen is it safe to buy levitra on line Dosage Of Amoxicillin For Respiratory Disorder Cialis Pills Sale Ontario
Viagra Umsatz 2010 Buy Levitra Online Canada Buy cheap cialis Medicamento Priligy 30 Mg
Amoxicillin 400mg 5ml Suspension Purple Viagra Pills Direct Provera Order levitra on line Prix Du Viagra 100mg Can You Safely Take Expired Amoxicillin Retin A Online No Prescription
Fedex Zentel Albex Secure With Free Shipping Winston Zithromax For Strep Throat Viagra Lauft Aus viagra Sildenafil 100 Mg Kamagra Oral Jelly Priligy Approuve Au Canada Ciprofloxacin 500 Mg Buy
Viagra Levitra O Cialis Does Amoxicillin Cure Bladder Infections cialis price Amitriptyline No Rx Needed Clomid Fast Shipping Caratteristiche Levitra 10 Mg
Levitra En Andorra cialis buy online Cephalexin Human Dosage
Dosi Levitra On Line Macrobid 100mg Levitra En Mujeres levitra 20mg tablets mfg gsk Zithromax Solution Dosage Cialis Wirkungseintritt
Levitra Meds Pyrantel Pamoate Interactions With Amoxicillin viagra Contraindicaciones De Cialis Cialis A Vendre Montreal

#8 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 29/10/2017, 14:06

Gineric Viagra From Canada Propecia Complicaciones cialis Brand Cialis Price Buy Real Viagra No Prescription Viagra Pfizer Ohne Rezept
Cialis 5 Mg Daily Success Comprar Viagra Con Paypal Cephalexin Used For What Ailment viagra online Penegra Amoxicillin For Dental Abscess





Veja alguns posts relacionados com: paginação, noticia, portal

0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq