ok, im doin this guestbook thing. it reads some entries from a .txt file in a format like this.
%bob#bob@yahoo.com#www.yahoo.com#aug 9#hello out there!
the following code displays the entries in the .txt file with the newest entry on top.
what i need help with is i only want 10 entries per page. so you will see the newest 10 on the front page, then click a link to view the next ten and so on and so on. how do i do this? thanks.
// Open the datafile and read the content
$newfile = fopen($filelocation,"r");
$content = fread($newfile, filesize($filelocation));
fclose($newfile);
// Remove the slashes PHP automatically puts before special characters
$content=stripslashes($content);
// Put the entries into the array lines
$lines = explode("%",$content);
// Define and fill the reverse array (showing the last entry first)
$rev=array();
for ($i=sizeof($lines)-1;$i>0;$i--){array_push($rev,$lines[$i]);}
$lines=$rev;
// Display all the entries of the guestbook
while(list($key)= each ($lines)){
/*
/ split the data lines into a user array
/ user[0] is the name, [1] is the email, [2] is the url [3] is the date and [4] the message
*/
$user = explode("#",$lines[$key]);
// Display the entries, here you can tweak HTML
echo "<p><b>$user[4]</b><br>posted on $user[3] by <a href=\"mailto:$user[1]\">$user[0]</a><br>$user[2]</p>";
}