Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to separate elements over multiple pages. ([1-5] [5-10])

Status
Not open for further replies.

voshka

IS-IT--Management
Oct 15, 2001
2
GB
Can some one please point me in the right direction?
I am trying to create various scripts to use on my site, including image gallery and guestbook.
There is however, one feature, which I am unable to complete by myself, and I cannot find it in any Perl FAQ.

Say, for example, that there are 850 entries in the guestbook (wishful thinking, I know :) and the script is set for displaying 25 entries per page.
When the visitor would wish to go to the next page, he would just click on the link e.g.
<- [1-25] [25-50] [50-75] [75-100] ->

I see this used in many guestbook and search engines, but I cannot find the source code to study it.

Any pointers that some one can provide will be highly appreciated!
 
Either the guestbook has to be manually broken up into static pages, or the program which displays the guestbook pages does so on the fly, after first figuring out how many entries there are, and the links you mentioned call the program to display a particular page and pass it a parameter like
Code:
?start=25
so it knows which page to display. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Yes, this much I know.

however, how do I go about doing it?
 
Are you using a database, such as a SQL database like mySQL? If so, then get the SQL to do the work for you:

[tt]
SELECT * FROM entries LIMIT $start 25
[/tt]

What this does is select entries starting at number $start (variable passed via GET method) and it does it for 25 entries.

Hope this helps.

-Vic vic cherubini
krs-one@cnunited.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top