Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: web counter, next-page method?

From: carl:cybercraft at: 8-Apr-2004 6:52

On 07-Apr-04, Petr Krenzelok wrote:
> Hi, > I will soon prepare some part of portal. Let's suppose I get data > from db, I have template system, where I simply put data into table > or whatever xhtml structure. Now what I am not sure about how to do > is - e.g. my table will have 30 rows, db query returns 150 rows, so > I need to introduce some next-page continuation mechanism. Any > suggestions? That is not about search & replace only. xtml template > is designed by our gfx designer, cgi/data part is mine > responsibility. We just set yesterday and our designer asked, what > should he put into xhtml template? And now I am not sure how to do > it. Maybe it could use similar aproach as when you construct gfx > based counter? Dunno. Any suggestions, examples?
Maarten and Hallvard have given good replies, to which I'd add that using the query-string to keep track of both the search-query and page-number is a good idea, as then people can bookmark their searches. ie, something like this... ; search for "da do" returns... ; next-page clicked returns... This also has the advantage of allowing people to edit the query by hand, thus jumping to near the end (say) of a large result by changing skip=30 to skip=300. Useful if the results have been sorted. There's a slight problem with that in that the database may change before the next-page button is clicked on, so you might be skipping over data you really should be displaying. You could get around that by keeping a tempory file of the full search results and have an id pointing to it, but then it might show items that are no longer in the database so it's really six of one and half a dozen of the other. The closest thing I've done to this is... but it doesn't use SQL and the search just stops at about 500 results - no paging ;-) But where you are is all tracked by the query string, so if you're looking at a weeks' results for a date and change the date, you still get a week's results. -- Carl Read