Functions:pagination

From Whirlwind eCommerce Wiki
Revision as of 20:45, 3 December 2008 by Root (Talk | contribs)

Jump to: navigation, search

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">&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

example 1

example 1 goes here

example 2

example 2 goes here

See Also