Getestet
PHP
<h1>Linksammlung zu Fotografie</h1>
<table border="1">
<thead>
<tr>
<th>Nr</th>
<th>URL</th>
<th>Beschreibung</th>
</tr>
</thead>
<?php
if (file_exists("linksammlung.txt"))
{
$lines = file ("linksammlung.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$zeilennr = 0;
foreach ($lines as $line)
{
$data = explode("|", $line);
$zeilennr++;
if ($zeilennr % 2)
$color = 'silver';
else
$color = '#7FFFFF';
echo "<tr style='background-color:$color'>
<td>$zeilennr</td>
<td><a href='$data[0]'>$data[0]</a></td>
<td>$data[1]</td>
</tr>";
}
}
else
echo "Datei nicht vorhanden";
?>
</table>
Alles anzeigen
wenn das immer noch nicht geht, dann stimmt der Inhalt der Datei nicht oder die Datei existiert nicht.