Quote:
|
Originally Posted by Raven_Writer
Hm...maybe seperate each item by underscores or something, and scan the file for it, and each time it's found, fill an array w/ the info and also use a counter. An example:
|
Thanks, I'll try that, really the while(($num_news < 5) && ($stuff != eof())) is what I was looking for, just not really sure where to put it in the code.
EDIT: I've got it, rudimentary as it is:
PHP Code:
<?
$counter = 0;
$data = file('news.txt');
$data = array_reverse($data);
foreach($data as $element)
{
if($counter < 5)
{
$element = trim($element);
$pieces = explode("|", $element);
echo $pieces[0] . $pieces[1] . $pieces[2] . $pieces[3];
echo "<hr>\n";
}
else
{
}
$counter = $counter + 1;
}
?>
__________________
2005 Las Vegas Regional Autodesk Visualization Award
2005 Las Vegas Regional #8 Seeded Alliance with 988 and 1505
2006 Southern California Regional #15 seed