API16:JPagination/getLimitBox
From Joomla! Documentation
Description
Creates a dropdown box for selecting how many records to show per page.
Syntax
getLimitBox()
Returns
string The html for the limit # input box.
Defined in
libraries/joomla/html/pagination.php
Importing
jimport( 'joomla.html.pagination' );
Source Body
public function getLimitBox()
{
$app = JFactory::getApplication();
// Initialise variables.
$limits = array ();
// Make the option list.
for ($i = 5; $i <= 30; $i += 5) {
$limits[] = JHtml::_('select.option', "$i");
}
$limits[] = JHtml::_('select.option', '50');
$limits[] = JHtml::_('select.option', '100');
$limits[] = JHtml::_('select.option', '0', JText::_('JOPTION_ALL'));
$selected = $this->_viewall ? 0 : $this->limit;
// Build the select list.
if ($app->isAdmin()) {
$html = JHtml::_('select.genericlist', $limits, $this->prefix . 'limit', 'class="inputbox" size="1" onchange="submitform();"', 'value', 'text', $selected);
}
else {
$html = JHtml::_('select.genericlist', $limits, $this->prefix . 'limit', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $selected);
}
return $html;
}
Examples
Code Examples