Pager::getPreviousPageID (Previous) (Next) Pager::isFirstPage

View this page in Last updated: Sun, 29 Jun 2008
English | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Plain HTML

Pager::getPerPageSelectBox()

Pager::getPerPageSelectBox() -- Returns a string with a XHTML SELECT menu, to choose how many items per page should be displayed.

Parameter

  • integer $start - Min. number of items per page (optional)

  • integer $end - Max. number of items per page (optional)

  • integer $step - Increment between two options (optional)

  • boolean $showAllData - If true, perPage is set equal to totalItems (optional)

  • array $extraParams (optional)

    • 'optionText': text to show in each option. Use '%d' where you want to see the number of pages selected.

    • 'attributes': (html attributes) Tag attributes or HTML attributes (id="foo" pairs), will be inserted in the <select> tag.

    • 'checkMaxLimit': if true, Pager checks if $end is bigger than $totalItems, and doesn't show the extra select options.

Description

Returns a string with a XHTML SELECT menu, useful for letting the user choose how many items per page should be displayed. If parameter useSessions is TRUE, this value is stored in a session var. The string isn't echoed right away so you can use it with template engines.

Example

This example shows how you can create a select box to let your users choose the number of items to display on each page.


<?php
include 'Pager/Pager.php';

$params = array(
    'mode'       => 'Jumping',
    'perPage'    => 3,
    'delta'      => 2,
    'itemData'   => array('a','b','c','d','e',[...omissis...],'z')
);
$pager = & Pager::factory($params);

$selectBox $pager->getPerPageSelectBox();

echo '<form action="' htmlspecialchars($_SERVER['PHP_SELF']) . '" method="GET">';
echo $selectBox;
echo '<input type="submit" value="submit" />';
echo '</form>';
?>

Return value

return string with the XHTML SELECT menu.

Pager::getPreviousPageID (Previous) (Next) Pager::isFirstPage

Download Documentation Last updated: Sun, 29 Jun 2008
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.