Ver Mensaje Individual
  #7 (permalink)  
Antiguo 11/05/2007, 12:15
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Re: Mostrar imagenes de un directorio

Prueba asi:
Código PHP:
<?php
$variable 
0;//seteamos a 0 el sumador
$valor 5;//seteamos a 6 las imagenes a mostrar por cada linea

echo "<table><tr>";
$directorio opendir("img/");

    while(
$archivo readdir($directorio))
    {
        
$nombreArch str_replace("""Atras"ucwords($archivo));
        if(
$variable $valor){ echo "<tr>";
         }

            echo 
"<td width='' height=''><a href='img/$archivo'>";
            echo 
"<img src='img/$archivo' width='140' height='110'";
            echo 
" border=0>";
            echo 
"";

        if(
$variable >= $valor){// si es mayor o igual añadimos </TR>
            
echo "</tr>";
            
$variable 0;//seteamos a 0 el sumador y volvemos a empezar si quedan mas imagenes
        
}//end if
              
$variable++;//empezamos a sumar +1
    
}//end while
    
closedir($directorio);
echo 
"</tr></table>\n";
?>