Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/07/2006, 04:42
Avatar de susaninhax
susaninhax
 
Fecha de Ingreso: noviembre-2004
Mensajes: 358
Antigüedad: 19 años, 5 meses
Puntos: 3
Pregunta paginador sencillo boton anterior y sigueinte

Buenas compañeros;

Estoy tratando de hacer un paginador sencillo de noticias, con botón de anterior y siguiente. Pero me está resultando dificicil.
Quiero que me muestre las noticias de 2 en 2, y lo único que se me ha ocurrido es esto pero no se ni como decirle que me muestre 2, ni como indicarselo en los botones de siguiente y anterior....
Tengo la cabeza hecha un lío....
Código PHP:
   <table bgcolor="#EFEFF1" align="center" cellspacing="0" cellpadding="0" border="0" width="256px">
<?php                       
$sql
="select id_noticia, titulo, frase
      from noticias
      where activo='si'
      order by  fotografia"

      
$result=mysql_query($sql,$link) or die(mysql_query());
$cont=0;                                
while(
$row=mysql_fetch_array($result)){
$id_noticia[$cont]=$row["id_noticia"];    
$titulo[$cont]=$row["titulo"];
$frase[$cont]=$row["frase"]
$cont++;
$conta_matriz=count($id_noticia);  ?>


    <tr>
        <td width="127px" valign="top"><img src="aquí la imagen>" galleryimg="no"></td>
        <td width="12px"><img src="../../images/shim.gif" galleryimg="no" WIDTH="1" HEIGHT="1"></td>
        <td width="111px" valign="top"><?php echo $titulo[$_GET["cont"]]; ?><br><span class="texto_gris_peque"><?php echo $frase[$_GET["cont"]]; ?> </span>         
          <br>
      </td>
        
    </tr><tr>
        <td colspan="3"><img src="../../images/shim.gif" height="18px"></td>
    </tr>
<? ?>
    </table>

    <table align="center" cellpadding="0" cellspacing="0" border="0" width="256px"><tr>
        <td valign="bottom" nowrap><img src="../../images/shim.gif" width="8px"><font class="texto3"></font> <?php if ($_GET["cont"]>'0') {?>
<a href="<? echo $_SERVER['PHP_SELF']; ?>?cont=<?php echo ($_GET["cont"]-1); ?>"><img src="../../images/anterior.gif" border="0" WIDTH="100" HEIGHT="16"></a></td>

        <td nowrap><img src="../../images/shim.gif" border="0" WIDTH="1" HEIGHT="1"></td>
<?php if($_GET["cont"]<($conta_matriz-1)) {?>
        <td valign="bottom" align="right" nowrap><a href="<? echo $_SERVER['PHP_SELF']; ?>?cont=<?php echo ($_GET["cont"]+1); ?>"><img src="../../images/siguiente.gif" border="0" WIDTH="100" HEIGHT="16"></a><img src="../../images/shim.gif" width="13px"></td>
<?php }elseif($_GET["cont"]== '0'){?>

        <td align="right" nowrap><img src="../../images/shim.gif" border="0" WIDTH="1" HEIGHT="1"><img src="../../images/shim.gif" width="13px"></td>
<?php ?>

    </tr></table>
Alguien me ayuda a hacer que esto funcione porfaaa!!!!!

Muchas gracias de antemano!!

Última edición por susaninhax; 12/07/2006 a las 04:51