Thread: Organize Fopen
View Single Post
Re: Organize Fopen
Old
  (#4)
Ancient
PodBot MM's Laziest Waypointer
 
Ancient's Avatar
 
Status: Offline
Posts: 1,010
Join Date: Jan 2005
Location: Nebraska, United States of America
Default Re: Organize Fopen - 22-08-2008

PHP Code:
$filename "news.txt";
$fp fopen($filename"r");
$contents fread($fpfilesize($filename));
$newsTable explode("|NEWS|"$contents);
//print_r($newsTable);
for($i 0count($newsTable) > $i$i++)
 {
  
$news[$i] = explode("|~|"$newsTable[$i]);
 }
//print_r($news);
  
for($i count($news); $i$i--)
   {
 
     
// Descend From Newest to oldest
   

This works good, but I don't know if it will use to much PHP memory. I might have to do some obj_flush. It seems to work well. Podbot MM Test Page.

Code:
|NEWS|New Official Beta Release|~|Info
|NEWS|More|~|Body
Should be like

Explode |NEWS|
$newsTable[0] = "New Official Beta Release|~|Info";
(split / explode again: |~|)
$newsTable[0][0] = "New Official Beta Release";
$newsTable[0][1] = "Info";

I just hope I don't need to use obj_flush. I know the file won't be over 8 MB any time soon.


[Web Designer][Waypointer][Gamer]
CFE Games Administrator
[CFE]Games.com
[Never Trust the Untrusted]
  
Reply With Quote