For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > May 2004 > RE: [SMARTY] Paging db results









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author RE: [SMARTY] Paging db results
Chris Hubbard

2004-05-06, 11:09 pm

George,
The *right* way to do this (it's called pagination), is to limit your result
set in the php code. Send to the template the data that you want to display
on the screen. Then in the php code create your pagination links. There's
a couple models for how the links are displayed. You could do [prev] [next]
buttons, or < 1 2 3 > like google, or < 1 2 3 4...10 11 >. In all cases you
determine what the pagination links are and send them as a string or array
to smarty to display.

Chris


-----Original Message-----
From: George Pitcher [mailto:george.pitcher@ingenta.com]
Sent: Thursday, May 06, 2004 12:16 AM
To: smarty-general@lists.php.net
Subject: [SMARTY] Paging db results


Hi,

I'm new to Smarty, having played around with it for a w now.

I'm building a web version of a Filemaker database gui and I need to be able
to produce paged results. These aren't the usual 10 or 25 rows per page, but
1 record per page, displaying around 60 fields. The recordset could be as
many as 6-700.

Just to complicate matters, in addition to moving through the recordset I
als want to be able to move between different functional pages, whilst
remaining in the curent position of the original recordset. Ideally, this
would not entail performing a SQL query each time I change layouts.

I'm using PEAR DB to access MySQL and my development is based on Win2K/IIS5
but final deployment will be Linux/Apache.

Any tips, suggestions or advice would be welcome.

George in Oxford

--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com