• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

Bilder in Tabellen

Status
Für weitere Antworten geschlossen.

MadMax777

Neues Mitglied
Hallo Leute,

ich möchte eine Tabelle erzeugen in dem jeweils pro Zeile vier Bilder sind. Da es 96 Bilder insgesamt sind ergibt dies 24 Zeilen. Nur leider bleibt die Seite komplett leer.

Mein Code sieht wie folgt aus:
PHP:
<?php
echo'<table width="100%" border="0" cellspacing="10" cellpadding="1">';
for ($rows = 0; $rows => 96; $rows=$rows+4)
{
echo'<tr>';
	for ($cols = 1, $cols == 4; $cols++)
	{
		echo'<td>';
		$pics = $rows + $cols;	
		echo'<img src="./Alpentour/Thumbnail/tn_CIMG'.$pics.'.jpg" width="120" height="90">';
		echo'</td>';
	}
echo'</tr>';
}
echo'</table>';
?>

Jetzt die Frage aller Fragen ;) was mache ich falsch?

Vielen Dank für eure Hilfe.
 
hi, versuch es mal so

PHP:
echo'<table width="100%" border="0" cellspacing="10" cellpadding="1">';
for ($rows = 1; $rows <= (96/4); $rows++)
{
echo'<tr>';
    for ($cols = 1; $cols <= 4; $cols++)
    {
        echo'<td>';
        $pic = $rows + $cols;
        echo'<img src="./Alpentour/Thumbnail/tn_CIMG'.$pic.'.jpg" width="120" height="90">';
        echo'</td>';
    }
echo'</tr>';
}
echo'</table>';
 
=> klappt nicht, das ist syntaktisch schon mal falsch und logisch auch, <= sollte klappen.

wie heissen denn die bilder ?
 
Mittlerweile funktioniert es. Habe es mal schritt für schritt gemacht. Erst mal nur die Schleifen eingebaut und dann die Tabelle mit den Bildern.

Hier zum Abschluss der funktionierende Code:

PHP:
<?php
echo"<div align='center'>";
echo"<table width='480px' border='0' cellspacing='1' cellpadding='1'>";
for ($rows = 0; $rows < 96; $rows=$rows+4)
{
	echo"<tr>";
	for ($cols = 1; $cols <=4; $cols++)
	{
		echo"<td width='120' height='90'>";
		$pics = $cols + $rows;
		echo"<a href='./Inhalte/pictures.php?bild=".$pics."&lan=$lan' target='_blank'><img src='../aqid/Alpentour/Thumbnail/tn_CIMG".$pics.".jpg' width='120' height='90'></a>";
		echo"</td>";
	}
	echo"</tr>";
}
echo"</table>";
echo"</div>";
?>
 
Status
Für weitere Antworten geschlossen.

Neueste Beiträge

Zurück
Oben