von Gr0bY |
habe schon die antwort thx an alle die sich beteiligt haben und für alle die ein ähnliches prob haben hier die lösung!
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17: | <?
$datei = file("db.txt");
$datei = array_reverse($datei);
for ($i=0; $i<count($datei); $i++) {
$eintrag = explode("|", trim($datei[$i]));
?>
<table cellpadding="0" cellspacing="0" class="oben" ...>
<?php echo $eintrag[0]; ?>
<?php echo $eintrag[1]; ?>
<?php echo $eintrag[2]; ?>
<?php echo $eintrag[3]; ?>
<?php echo $eintrag[4]; ?>
<?php echo $eintrag[5]; ?>
</table>
<?
}
?> |
|
von Gr0bY |
so ist das gemacht!
1:
2:
3:
4:
5:
6:
7:
8:
9:
10: | <?
$daten="<tr><td background="img/newso.gif" height="32" width="600" leftmargin="0" topmargin="0" cellpadding="0" cellspacing="0"></td></tr>
<tr><td width="600" leftmargin="0" topmargin="0" cellpadding="0" cellspacing="0"><img src=img/$img> </br><b>$topic</b></br></br>$text</td></tr>
<tr><td background="img/newsu.gif" height="28" width="600" leftmargin="0" topmargin="0" cellpadding="0" cellspacing="0"><font size="2"> $datum von<font size="2" color="#336699"> $name </font></font><a href="http://$url">$urlname</a> </td></tr>|n";
$datenbank = "db.txt";
$datei = fopen($datenbank,"a");
fwrite($datei, $daten);
echo("Ihr Eintrag wurde aufgenommen...");
?>
<a href="index.php">lesen</a> |
|
von Can |
Wie sind die News denn aufgebaut? Gibts in einer Zeile (der Datei) mehrere Nachrichten? |
von Gr0bY |
verstehe ich nicht ganz! wie soll das dann aussehen?
wo muss ich das genau hinkritzeln? |
von Kleno |
Hi,
wenn Du schon einmal eine Datei in ein Array eingelesen hast, brauchst Du nur die PHP-Funktion "array_reverse( $dein_array )" aufzurufen und schon ist der ehemals letzte Datensatz der 1.
MfG
Jürgen |
von Gr0bY |
Keine ahnung was ich da falsch verstanden habe aber es liest immernoch falschrum??
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16: | <?
$datei = fopen("db.txt", "r") ;
while (!feof($datei)) {
$zeile = fgets($datei, 512) ;
$eintrag = explode("|", trim($zeile)) ;
?>
<table cellpadding="0" cellspacing="0" class="oben" width="600" border="0" align="center" bgcolor="#293A4E">
<?php
for ($idx=count($eintrag)-1; $idx>=0; $idx--)
echo $eintrag[$idx];
?>
</table>
<?
}
fclose($datei) ;
?> |
|
von Can |
Wenn du die News in nem Array hast, ist es ganz einfach:
1:
2: | for ($idx=count($array)-1; $idx>=0; $idx--)
echo $array[$idx]; |
Can |
von Gr0bY |
hi, ich bin anfänger und habe mit viel arbeit ein news system gebastelt *stolz*!
hat alles auch sher gut geklappt bis jetzt, nur weis ich nicht wie man eine txt datenbank von hintenaus ausliest.
ich gebe die arrays bei mir so aus :
1:
2: | <?php echo $eintrag[0]; ?>
<?php echo $eintrag[1]; ?> |
aber es nutzt auch nichts wenn ich es so mache
1:
2: | <?php echo $eintrag[1]; ?>
<?php echo $eintrag[0]; ?> |
was kann ich machen? |