Thread: PHP Question
View Single Post
  #6   Spotlight this post!  
Unread 11-06-2004, 16:25
Joshua May's Avatar
Joshua May Joshua May is offline
Go Bears!
FRC #1110 (Binary Bulldogs)
Team Role: College Student
 
Join Date: Nov 2003
Rookie Year: 2003
Location: Berkeley, CA
Posts: 1,306
Joshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond repute
Send a message via AIM to Joshua May
Re: PHP Question

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;
}
?>
__________________
The FIRST Wiki - openFIRST - Ultimate Robot Challenge - URC Wiki
I currently have 50 GMail invites, PM or email me for one.
UC Berkeley Class of 2009

2005 Las Vegas Regional Autodesk Visualization Award
2005 Las Vegas Regional #8 Seeded Alliance with 988 and 1505
2006 Southern California Regional #15 seed

Last edited by Joshua May : 11-06-2004 at 16:53.