ok i have a text file that contains all of my news in it.
filename is news.txt
I would like to have the the news accessed from two places.
first of all a LATEST NEWS section and a NEWS section on my site.
the latest news will online print the last say 10 items in the news. Each news item takes up one line.
this is my news.php file that will read the news.txt file... this works but i only want the first 10 lines.
<?php
$data = file('news/news.txt');
$data = array_reverse($data);
foreach($data as $element) {
$element = trim($element);
$pieces = explode("|", $element);
print "<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">";
echo "<tr><td style=\"border:1px #ffffff dotted\" onmouseover=\"this.style.backgroundColor='#cccccc';\" onmouseout=\"this.style.backgroundColor='transparent';\"><font face=\"Arial\" size=\"2\" color=\"FF0000\"><b>" . $pieces[1] . "</b></font><BR><font face=\"Arial\" size=\"1\" color=\"333333\"><em>" . $pieces[0] . "</em></font><BR><font face=\"Arial\" size=\"2\" color=\"000000\">" . "" . $pieces[2] . "</font></td></tr>";
print "</table>";
}
?>
Please help 😃
thanks