I wrote some code for displaying news on my website.
Code goes like this:
<?
$newsfile = 'news.txt';
echo "<B>TRENUTN E VIJESTI</B><br>\n";
$data = file($newsfile) ;
$data = array_reverse($ data);
echo "<span style=\"normal 11 Verdana; color:#fff; text-align:justify;\ ">";
foreach($data as $element) {
$element = trim($element);
$pieces = explode("|", $element);
echo $pieces[2] . "<BR>" . "<span style=\"font:no rmal 11px
Tahoma\"><u>Pub lished</u>: " . $pieces[1] . " " . $pieces[0] .
"</span></span><BR><br>";
}
?>
I have form that puts content in flat file.
Messages are writen in flat file in format like this:
21.Feb 2006.|Dalibor|S ome message text
14.Feb 2006.|Dalibor|O ther message text...
I need piece of code for displaying last 5 messages and for deleting
certain messages.
Can you help me? Thanks!
--
..:Dalibor:.
Code goes like this:
<?
$newsfile = 'news.txt';
echo "<B>TRENUTN E VIJESTI</B><br>\n";
$data = file($newsfile) ;
$data = array_reverse($ data);
echo "<span style=\"normal 11 Verdana; color:#fff; text-align:justify;\ ">";
foreach($data as $element) {
$element = trim($element);
$pieces = explode("|", $element);
echo $pieces[2] . "<BR>" . "<span style=\"font:no rmal 11px
Tahoma\"><u>Pub lished</u>: " . $pieces[1] . " " . $pieces[0] .
"</span></span><BR><br>";
}
?>
I have form that puts content in flat file.
Messages are writen in flat file in format like this:
21.Feb 2006.|Dalibor|S ome message text
14.Feb 2006.|Dalibor|O ther message text...
I need piece of code for displaying last 5 messages and for deleting
certain messages.
Can you help me? Thanks!
--
..:Dalibor:.
Comment