hey
ich will aus einer TXT-datei die daten auslesen...diese sind dort in 3 zeilen ausgegeben.
danach folgen 2 Leerzeilen und der nächste Datensatz...
nun möchte ich per PHP-Script die daten auslesen und das wie folgt:
1. Zeile in der Farbe #000080
2. Zeile in der Farbe #000080
3. Zeile in der Farbe #0000fe
mein problem is, dass ich es schon so hinbekommen habe mit den farblichen Zeilen, nur er liest nicht aus der datei aus...
Original-Script
Das Problem bei dem Script ist aber, dass es bei mir nicht so funktioniert, da ich mit dem befehl "index.php?action=news" arbeite. da liest er gar nix aus.
kann mir jemand dabei helfen?
ich will aus einer TXT-datei die daten auslesen...diese sind dort in 3 zeilen ausgegeben.
Quadro-Beach-Night
03 07 2004 | 19:00
Quadro-Beach-Night auf dem Beachplatz Gräfendorf
03 07 2004 | 19:00
Quadro-Beach-Night auf dem Beachplatz Gräfendorf
nun möchte ich per PHP-Script die daten auslesen und das wie folgt:
1. Zeile in der Farbe #000080
2. Zeile in der Farbe #000080
3. Zeile in der Farbe #0000fe
mein problem is, dass ich es schon so hinbekommen habe mit den farblichen Zeilen, nur er liest nicht aus der datei aus...
Original-Script
<?php
if($action==show || empty($action))
{
$min=$_GET[min];
$max=$_GET[max];
$NewsFile = file("datei.txt");
for ($i = 0; $i < sizeof($NewsFile); $i++)
$NewsFile[$i] = stripslashes($NewsFile[$i]);
for ($i = 0; $i < sizeof($NewsFile); $i+=4)
{
if($max=='')
{
$max=10;
$min=0;
$n=0;
}
if($n<=$max && $n>=$min)
{
// hier ist das design für alle News
?>
<table width="500" bordercolor="#000000" border="1" style="border-collapse:collapse" cellpadding="3">
<tr><td width="500" bgcolor="#000080" height="20"><font size="1" color="#ffffff" style="font-family:verdana;"><?=$NewsFile[$i]?></font></td></tr>
<tr><td width="500" bgcolor="#000080" height="20"><font size="1" color="#ffffff" style="font-family:verdana">Beginn: <?=$NewsFile[$i + 1]?></font></td></tr>
<tr><td width="500" bgcolor="#0000fe"><font color="#ffffff" style="font-family:verdana;font-size:12px"><?=$NewsFile[$i + 2]?></font></td></tr>
</table>
<?php
}
$n++;
}
echo "<center>";
if($min!='0'){
$maxback=$max-10;
$minback=$min-10;
echo "<a href=news.php?max=$maxback&min=$minback&action=sho w>zurück | </a>";
//echo "<a href=javascript:history.back()>zurück | </a>";
}
$max=$max+10;
$min=$min+10;
echo "<a href=news.php?max=$max&min=$min&action=show>weiter </a></center>";
}
if($action==show1)
{
$datei = fopen("datei.txt", "r");
for($i = 1; !feof($datei); $i++)
{
$line = $line . "|" . chop(fgets($datei, 1024));
}
fclose($datei);
$line = stripslashes($line);
$daten = explode("|", $line);
// hier ist das design für die letzte Nachricht
echo "
<table width=500 bordercolor=#000000 border=1 style=border-collapse:collapse cellpadding=3>
<tr><td width=500 bgcolor=#000080 height=20><font size=1 color=#ffffff style=font-family:verdana;> ".$daten[1]."</font></td></tr>
<tr><td width=500 bgcolor=#000080 height=20><font size=1 color=#ffffff style=font-family:verdana>Beginn: ".$daten[2]." | ".$daten[3]."</font></td></tr>
<tr><td width=500 bgcolor=#0000fe><font color=#ffffff style=font-family:verdana;font-size:12px>".$daten[4]."</font></td></tr>
</table>
";
}
?>
if($action==show || empty($action))
{
$min=$_GET[min];
$max=$_GET[max];
$NewsFile = file("datei.txt");
for ($i = 0; $i < sizeof($NewsFile); $i++)
$NewsFile[$i] = stripslashes($NewsFile[$i]);
for ($i = 0; $i < sizeof($NewsFile); $i+=4)
{
if($max=='')
{
$max=10;
$min=0;
$n=0;
}
if($n<=$max && $n>=$min)
{
// hier ist das design für alle News
?>
<table width="500" bordercolor="#000000" border="1" style="border-collapse:collapse" cellpadding="3">
<tr><td width="500" bgcolor="#000080" height="20"><font size="1" color="#ffffff" style="font-family:verdana;"><?=$NewsFile[$i]?></font></td></tr>
<tr><td width="500" bgcolor="#000080" height="20"><font size="1" color="#ffffff" style="font-family:verdana">Beginn: <?=$NewsFile[$i + 1]?></font></td></tr>
<tr><td width="500" bgcolor="#0000fe"><font color="#ffffff" style="font-family:verdana;font-size:12px"><?=$NewsFile[$i + 2]?></font></td></tr>
</table>
<?php
}
$n++;
}
echo "<center>";
if($min!='0'){
$maxback=$max-10;
$minback=$min-10;
echo "<a href=news.php?max=$maxback&min=$minback&action=sho w>zurück | </a>";
//echo "<a href=javascript:history.back()>zurück | </a>";
}
$max=$max+10;
$min=$min+10;
echo "<a href=news.php?max=$max&min=$min&action=show>weiter </a></center>";
}
if($action==show1)
{
$datei = fopen("datei.txt", "r");
for($i = 1; !feof($datei); $i++)
{
$line = $line . "|" . chop(fgets($datei, 1024));
}
fclose($datei);
$line = stripslashes($line);
$daten = explode("|", $line);
// hier ist das design für die letzte Nachricht
echo "
<table width=500 bordercolor=#000000 border=1 style=border-collapse:collapse cellpadding=3>
<tr><td width=500 bgcolor=#000080 height=20><font size=1 color=#ffffff style=font-family:verdana;> ".$daten[1]."</font></td></tr>
<tr><td width=500 bgcolor=#000080 height=20><font size=1 color=#ffffff style=font-family:verdana>Beginn: ".$daten[2]." | ".$daten[3]."</font></td></tr>
<tr><td width=500 bgcolor=#0000fe><font color=#ffffff style=font-family:verdana;font-size:12px>".$daten[4]."</font></td></tr>
</table>
";
}
?>
kann mir jemand dabei helfen?
Kommentar