02-01-2008, 10:51 PM
|
#7 (permalink)
|
|
The Acquainted
Join Date: Jan 2008
Posts: 119
Thanks: 21
|
Thanks for the post. Is that system more streamlined that what I have?
Quote:
Originally Posted by Salathe
How about :
PHP Code:
<?php header('Content-Type: text/plain; charset=UTF-8');
$comments = array();
$fp = fopen('comments.txt', 'r+');
if ( ! $fp) die ('Unable to load comments');
while ( ! feof($fp) && $comments[] = array_filter(fgetcsv($fp, 2048, '|')));
fclose($fp);
foreach ($comments as $comment)
{
$comment = array_combine(array('user', 'date', 'body'), array_values($comment));
echo 'Who posted: ', $comment['user'], "\n",
'Date: ', $comment['date'], "\n",
'Comment: ', $comment['body'], "\n\n";
}
The important one being line 7: while ....
|
|
|
|
|