in reply to Max Submissions?
anyways, here's what you can do with your version of the program:
You need to keep track of when it's time to write a new file. That means you need a counter of some sort. You'll have to store the counter in a different file again, maybe counter.txt.
open(C, "counter.txt") and $c = <C> and close C and $c++; open(C, ">counter.txt") and print C $c and close C;
Let's say you want to start a new file every time the counter reaches a multiple of 10. You might call the files that contain the html "view0.htm" for the first 10 entries, "view1.htm" for the next 10, and so on.
$fileno = int($c / 10); $filename = "view" . $fileno . ".htm"; open(DASH,">>$filename"); print DASH "print the entry here"; close DASH
That's almost all. If you want to have Links from one page of the guestbook to the next, you have two options: do it in HTML, with frames (yuck, I hate frames) or write the links into the view*.htm files. Putting the "back" at the top of each page:
and the "Next" link at the bottom is probably the easiest:if (int($c / 10) == $fileno ) { # this is the first time we write to this # file, because $c is 10 or 20 or 30 or ... # link back to the one before print DASH "<a href=view" . ($fileno-1) . ".htm>Back</a>"; }
if ( $c % 10 == 9 ) { # this is the last time we write to this # file, because $c is 9 or 19 or 29 or 39 or ... # link on to the next one print DASH "<a href=view" . ($fileno+1) . ".htm>Next</a>"; }
Assembling these code snippets in the right order is left as an exercise to the student ;-)
-- Brigitte 'I never met a chocolate I didnt like' Jellinek http://www.horus.com/~bjelli/ http://perlwelt.horus.at