Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/08/2011, 17:27
connieco
 
Fecha de Ingreso: agosto-2011
Ubicación: Bogota
Mensajes: 3
Antigüedad: 12 años, 8 meses
Puntos: 0
Pasar un listado de horizontal a vertical

Hola a todos, tengo un problema en php, es que estoy listando una carpeta y cada carpeta y/o archivo listado tiene ua imagen diferente.
El caso es que quiero que de horizontal
*
*
*
*
Pasen a los dos
**
**
Bueno este es el codigo
Código HTML:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<?php 
	$maindir = "." ; 
	$mydir = opendir($maindir) ; 
	$arch = "/"; //Nombre de este archivo.
	$exclude = array(".jpg") ; //Pon aqui los elementos que no quieras listar.
		
	//establecemos condiciones de paginación.
	if (!isset($pg))
	$pg = ($_GET['pg']);
	$cantidad = 10;  //registros por pagina.
	$inicial = $pg * $cantidad;
	
	//lee las carpetas y las mete en un array.
	while(false !== ($fn = readdir($mydir)))
	{
		if (is_dir($fn) && $fn != $exclude[0] && $fn != $exclude[1] && $fn != $exclude[2] && $fn != $exclude[3])
		{
			$lista[] = array (date ("d/m/y H:i:s",(filemtime($fn))),$fn);			
		}
	}
	closedir($mydir); //cerramos el directorio.
	
	rsort($lista); //reordenamos
	$total = count($lista); //contamos los elementos.
	$pages = intval($total/ $cantidad); //numero de paginas a mostrar
	
	//Mostramos las carpetas.
	
	$lista = array_slice($lista,$inicial);
	foreach($lista as $list)
	{
		if($i < $cantidad)
		{//con efecto sombra
		echo "<table>";
		echo "<tr>";
		echo "<td><br>$list[1] - $list[0]</td>";
		echo "</tr>";
		echo "<tr><td></td></tr>";
		echo "</table>";
		echo "<table>";
		echo "<tr>";
		echo "<td width='300'><a href='$list[1]/' target='_blank'><img src='$list[1]/index.jpg'/></a></td>";
		echo "</tr>";
		echo "</table>";
		
		$i++;
		}
	}
	
	
	//Paginación
	echo "<center><p>";
	if ($pg <>0)
	{
		$url = $pg - 1;
		echo "<font><a href='$arch?pg=".$url."'>&laquo; Anterior</a>&nbsp;</font>";
	}
	else 
	{
		echo " ";
	}
	for ($i = 0; $i <=$pages; $i++) 
	{
		if ($i == $pg) 
		{
			echo "<font><b>&nbsp;$i&nbsp;</b></font>";
		}
		else 
		{
			echo "<font><a href='$arch?pg=".$i."'>".$i."</a>&nbsp;</font>";
		}
	}
	if ($pg < $pages) 
	{
		$url = $pg + 1;
		echo "<font><a href='$arch?pg=".$url."'>Siguiente &raquo;</a></font>";
	}
	else 
	{
		echo " ";
	}
	echo "</p></center>";
?>
</body>
</html>