Hallo Forum,
leider weiss ich nicht mehr weiter. Ich habe eine Text-Datei die ich auslesen möchte. Das geht auch, nun möchte ich das die böcke in der Text-Datei durch eine schleife getrend ausgegeben werden.
Die Text Datei in der die daten sind sieht so aus:
Das ist der PHP-Code dazu.
Zum schluss endstehen 10 x 10 Felder in denn 5 x 5 Felder mit unterschiedlichen Grafiken endhalten sind, die aus der Text-Datei ausgelesen werden.
Bin für jeden hinweis Dankbar.
leider weiss ich nicht mehr weiter. Ich habe eine Text-Datei die ich auslesen möchte. Das geht auch, nun möchte ich das die böcke in der Text-Datei durch eine schleife getrend ausgegeben werden.
Die Text Datei in der die daten sind sieht so aus:
PHP Code:
Block-01
bg.gif bg.gif bg.gif bg.gif bg.gif
bg.gif bg.gif bg.gif bg.gif bg.gif
ws.gif ws.gif ws.gif ws.gif ws.gif
bg.gif bg.gif bg.gif ws.gif ws.gif
ws.gif ws.gif ws.gif ws.gif ws.gif
Block-02
bg.gif bg.gif bg.gif bg.gif bg.gif
ws.gif ws.gif ws.gif ws.gif ws.gif
ws.gif ws.gif ws.gif ws.gif ws.gif
ws.gif ws.gif ws.gif ws.gif ws.gif
ws.gif ws.gif ws.gif ws.gif ws.gif
Block-03
bg.gif bg.gif bg.gif bg.gif bg.gif
bg.gif bg.gif bg.gif bg.gif bg.gif
ws.gif ws.gif ws.gif ws.gif ws.gif
bg.gif bg.gif bg.gif bg.gif bg.gif
bg.gif bg.gif bg.gif bg.gif bg.gif
... nun so weiter
PHP Code:
$datei = "karte.txt"; // Name der Datei
$string = file($datei); // Datei in ein Array einlesen
$teile = explode(" ",$string[0]);
$a_01 = $teile[0];
$a_02 = $teile[1];
$a_03 = $teile[2];
$a_04 = $teile[3];
$a_05 = $teile[4];
$teile = explode(" ",$string[1]);
$b_01 = $teile[0];
$b_02 = $teile[1];
$b_03 = $teile[2];
$b_04 = $teile[3];
$b_05 = $teile[4];
$teile = explode(" ",$string[2]);
$c_01 = $teile[0];
$c_02 = $teile[1];
$c_03 = $teile[2];
$c_04 = $teile[3];
$c_05 = $teile[4];
$teile = explode(" ",$string[3]);
$d_01 = $teile[0];
$d_02 = $teile[1];
$d_03 = $teile[2];
$d_04 = $teile[3];
$d_05 = $teile[4];
$teile = explode(" ",$string[4]);
$e_01 = $teile[0];
$e_02 = $teile[1];
$e_03 = $teile[2];
$e_04 = $teile[3];
$e_05 = $teile[4];
echo"<table cellspacing=\"1\" cellpadding=\"1\" border=\"0\" bgcolor=\"#ff0000\"><tr>";
$a = 1;
while ($a <= 10) {
echo"<td>";
$i = 1;
while ($i <= 10) {
echo "<div align=\"center\">Block - $a - $i </div>";
echo"<table cellspacing=\"1\" cellpadding=\"1\" border=\"0\" bgcolor=\"#ff0000\">";
echo"<tr>";
echo"<td><img src=\"$a_01\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$a_02\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$a_03\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$a_04\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$a_05\" width=\"50\" height=\"32\"></td>";
echo"</tr>";
echo"<tr>";
echo"<td><img src=\"$b_01\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$b_02\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$b_03\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$b_04\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$b_05\" width=\"50\" height=\"32\"></td>";
echo"</tr>";
echo"<tr>";
echo"<td><img src=\"$c_01\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$c_02\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$c_03\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$c_04\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$c_05\" width=\"50\" height=\"32\"></td>";
echo"</tr>";
echo"<tr>";
echo"<td><img src=\"$d_01\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$d_02\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$d_03\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$d_04\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$d_05\" width=\"50\" height=\"32\"></td>";
echo"</tr>";
echo"<tr>";
echo"<td><img src=\"$e_01\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$e_02\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$e_03\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$e_04\" width=\"50\" height=\"32\"></td>";
echo"<td><img src=\"$e_05\" width=\"50\" height=\"32\"></td>";
echo"</tr>";
echo"</table>";
$i++;
}
echo"</td>";
$a++;
}
echo"</tr></table>";
Bin für jeden hinweis Dankbar.
Comment