Ver Mensaje Individual
  #7 (permalink)  
Antiguo 04/08/2010, 09:27
Avatar de masterojitos
masterojitos
 
Fecha de Ingreso: julio-2008
Ubicación: Lima Callao Chucuito
Mensajes: 1.931
Antigüedad: 15 años, 9 meses
Puntos: 105
Respuesta: Como hago Galeria en una tabla triple?

yo probe ambos codigos que te di, con tablas y con divs, y ambos funcionan.... lo unico que creo que seria tu problema es lo que te comente del "%".
Cita:
Nota.. en vez de "& # 3 7 ;" (sin espacios) debe de ser "%".
la idea de triby con divs estaba buena, pero yo la impletemente justamente por que tu necesitabas en 3 columnas y con los numeros... por eso te cree un segundo post.

te recomiendo que vuelvas a copiar bien el codigo y veras que todo esta bien.

te lo vuelvo a postear por si copiaste algo que no era.

Solucion con tablas:
Código PHP:
Ver original
  1. <?php    
  2. $path = "gal1/";
  3. $i = 0;
  4. echo "<table cellspacing='0' cellpadding='3' style='text-align:right;'>";
  5. if($manager = opendir($path)){
  6.     while(($file = readdir($manager)) !== false){
  7.         if($file != "." and $file != ".."){
  8.             if(strtolower(end(explode(".", $file))) == "jpg"){
  9.                 if($i % 3 == 0) echo "<tr>";
  10.                 $foto = base64_encode($path.$file);
  11.                 echo "<td>".($i + 1).". <a href='protecfoto.php?foto=$foto' /><img src='$path$file' alt='' width='216' height='134' border='0' /></a></td>";
  12.                 if($i % 3 == 2) echo "</tr>";
  13.                 $i++;
  14.             }
  15.         }
  16.         if($i > 13) break;
  17.     }
  18.     closedir($manager);
  19. }
  20. if($i % 3 <= 2 and $i % 3 > 0){
  21.     for($j = $i % 3; $j <= 2; $j++){
  22.         echo "<td>&nbsp;</td>";
  23.     }
  24.     echo "</tr>";
  25. }
  26. echo "</table>";
  27. ?>

Solucion con divs:
Código PHP:
Ver original
  1. <?php    
  2. $path = "gal1/";
  3. $i = 0;
  4. echo "<div style='text-align:right;'>";
  5. if($manager = opendir($path)){
  6.     while(($file = readdir($manager)) !== false){
  7.         if($file != "." and $file != ".."){
  8.             if(strtolower(end(explode(".", $file))) == "jpg"){
  9.                 $foto = base64_encode($path.$file);
  10.                 echo "<div style='float:left; margin:10px; width:250px;'>".($i + 1).". <a href='protecfoto.php?foto=$foto' /><img src='$path$file' alt='' width='216' height='134' border='0' /></a></div>";
  11.                 if($i % 3 == 2) echo "<div style='clear:left;' />";
  12.                 $i++;
  13.             }
  14.         }
  15.     }
  16.     closedir($manager);
  17. }
  18. echo "</div>";
  19. ?>

le das click a "ver original" y copias el contenido.

Un gusto apoyarte.... nos vemos
__________________
Atte. MasterOjitos :ojotes:
Todo sobre Programación Web
Las ultimas tendencias en Efectos y Recursos Web: MasterOjitos Blog