Content / help / paging .. concise-view << previous next >>

Biscuits Paginator Class

Pagination is a way of showing a small subset $paginator->pageRows ( returned by function $paginator->getPageRows() ) of rows from a larger total selection $paginator->rows of rows, from the query result $paginator->result .
This is done to aid navigation. For example, if we select rows from a database, the result set may include a total of 100,000 rows. It would not be a good idea to present all 100,000 rows in one massive web page, so we should first decide on the maximum number of rows to display on each page. We could call this the LIMIT, but the keyword LIMIT refers to a limit we impose on the main database SELECT statement.
Since version 9a, there is a new pagination class $paginator = $this->biscuits->loadMethod('paging', true);
Example - Member search of all members with a letter "e" in their name

Code Extract showing use of paging class

 $chessDB = $this->biscuits->loadMethod('chessDB'); 
// Get All Clubs for selection option 
 $result = $chessDB->getLeagues($selectedLeague); 
 $paginator = $this->biscuits->loadMethod('paging',true); 
 $paginator->rowClasses = array('odd pad10', 'even pad10');  
 $paginator->colDefs = array('league_name' => array('link' => '/chess/show-league/@value','colhead' => 'League'), 
 'season_name' => array('output' => true , 'colhead' => 'Season'), 
 'league_notes' => array('colhead' => 'Notes' ), 
 $showPage = true; 
 $paginator->setPaging($result, $showPage); 

Other examples

Example: products $shop->products() from the Online Shop

Setting the pp

pp = Per page. IE Rows per page. Eg: url?pp=3 sets 3 rows per page.
Note: pp (lower case only)

iBiscuits LOGO