Re: Pager_Sliding DB/Templates example

From: Date: Wed, 23 Jul 2003 11:43:14 +0000
Subject: Re: Pager_Sliding DB/Templates example
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-6760@lists.php.net to get a copy of this message
Joseph Blythe wrote:
Has anyone got any examples of using Pager_sliding with DB and templates, I have used DB_Pager but cant seem to get Pager_Sliding to function properly ?
There is a tricky way: - fetch the number of resultsets with count - create an array of this size with empty entries - create an DB_Pager instance - fetch the data and pass them to the array - create Pager_Sliding with the array - display the stuff practical: - you have ten result sets, you want to display one per page. -> $data=array_fill(0,10,''); - for the first page: $from=0 $limit=1 $numrows=10 - DB_Pager returns the first result set -> passed it to the first array entry $data[$from]=... - create DB_Pager with perPage=$limit itemData=$data - display the stuff for every further page you do the same with on different: - check for $_GET['pageID'] (else display the first page) -> $from = ($_GET['pageID']-1)*$limit - ie for the second page $data should looks like this: array('',value,'','','','','','','','') for #3 array('','',value,'','','','','','','') ... HTH

« previous php.pear.general (#6760) next »