Difference between revisions of "Functions:pagination"
From Whirlwind eCommerce Wiki
(New page: == Description == pagination() returns data and content to easily 'paginate' large data lists == Syntax == $pagination = eV::pagination($totalCount,$itemsPerPage,$pageNo,$link); == Param...) |
|||
Line 25: | Line 25: | ||
) | ) | ||
</pre> | </pre> | ||
+ | Elements from the returned array are as follows: | ||
+ | {|border=2 | ||
+ | |- | ||
+ | |Element | ||
+ | |Description | ||
+ | |Example | ||
+ | |- | ||
+ | |links | ||
+ | |STRING - HTML output including previous, next and page number links. Just echo this data where you want the pagination controls to appear to the visitor | ||
+ | |<a href="index.php?pageId=10&pageNo=1">&lt; PREVIOUS</a> <a href="index.php?pageId=10&pageNo=1">1</a> 2 <a href="index.php?pageId=10&pageNo=3">3</a> <a href="index.php?pageId=10&pageNo=4">4</a> <a href="index.php?pageId=10&pageNo=3">&lt; NEXT</a> | ||
+ | |- | ||
+ | |startIndex | ||
+ | |INT - the index of the first list element that should appear in the page (hide all elements before this) | ||
+ | |6 | ||
+ | |- | ||
+ | |endIndex | ||
+ | |INT - the index of the last list element that should appear in the page (hide all elements after this) | ||
+ | |10 | ||
+ | |} | ||
== Examples == | == Examples == |
Revision as of 20:45, 3 December 2008
Description
pagination() returns data and content to easily 'paginate' large data lists
Syntax
$pagination = eV::pagination($totalCount,$itemsPerPage,$pageNo,$link);
Paramaters
- $totalCount
- total number of items in the entire list to be paginated
- $itemsPerPage
- number of items to display on each pagination page
- $pageNo
- the current page number
- $link
- the base url to be used for each pagination link. This will automatically be appended with "&pageNo=#" for the appropriate page number for the link selected.
Return Values
Returns an associative array containing content output and list item indexes to be used to manage pagination. Below is the returned array:
Array ( [links] => String [startIndex] => INT [endIndex] => INT )
Elements from the returned array are as follows:
Element | Description | Example |
links | STRING - HTML output including previous, next and page number links. Just echo this data where you want the pagination controls to appear to the visitor | <a href="index.php?pageId=10&pageNo=1">< PREVIOUS</a> <a href="index.php?pageId=10&pageNo=1">1</a> 2 <a href="index.php?pageId=10&pageNo=3">3</a> <a href="index.php?pageId=10&pageNo=4">4</a> <a href="index.php?pageId=10&pageNo=3">< NEXT</a> |
startIndex | INT - the index of the first list element that should appear in the page (hide all elements before this) | 6 |
endIndex | INT - the index of the last list element that should appear in the page (hide all elements after this) | 10 |
Examples
- example 1
example 1 goes here
- example 2
example 2 goes here