Biscuits Pagination methods work on the following pagination properties
This is the total number of rows in before the views are split up and content is divided into views.
A single-page view may have it's own SELECT with only those rows required for that page view.
Biscuits pagination must integrate with both the MVC view files and the controller that makes the original database selection. The SELECT statement returns the total row count. totalRows
Need to know the number of rows to display on the page and the navigation html to display at the foot of the view.
'result' => $result,
'rowsPerPage' => $this->paginator->rowsPerPage,
'navigation' => $this->paginator->navigation,
'query' => $query,
'error' => $result->error,
The first SELECT will return the entire data set. This gives the paginator the value of, totRows. Subsequent views will only select the rows needed for that particular view and so this value will be passed through the final URL segment. All pagination properties needed for single-page views will be passed through the final URL segment, leaving all the other URL segments to fulfill there usual function.
The pagination properties passed through the URL segment will be hyphen delimited as follows: p-xx-yy-zz
In this version of the paginator, this value is not
taken directly from the URL as the SELECT
always selects ALL the matching rows and the yy and zz parameters
are used to LIMIT the output.
Later versions may tinker with the select for subsequent pages, rather than counting all the rows repeatedly.
Note: we make the start row for each divided view and NOT
the page number, so that we can view a page starting from any
row number. Usually the paginator will navigate though the page views
step by step in such a way that there is a meaningful page number.
Simple logic can determine whether the startRow is a logical page number
startRow based on the current rowsPerPage setting.
The startRow is an offset, so the first row will have startRow = 0, yy-zz are in the same order as two arguments of a LIMIT in MySQL.
start = (page - 1)*20 ;
end = 20 * page;
select * from table limit (start, end);
With two arguments, the first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1):
SELECT * FROM tbl LIMIT 5,10; # Retrieve rows 6-15