|Don't ask to ask, just ask|
Splitting stuff into many pages with back and next buttons - (Was: Max Submissions?)by bjelli (Pilgrim)
|on Sep 06, 2001 at 16:51 UTC||Need Help??|
Perl won't do this for you automatically, you have to program it. I agree with chadys advice, storing the entries in a database of some sort would be better than just storing the html.
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.
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.
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:
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