Hi!
Some peoples(me too) needs to custom limits in their pagination, but we cannot override these limits 'cause it's hardcoded. See the topic
https://groups.google.com/forum/#!topic/joomla-dev-general/nyZDKxeNLe4My suggestion: add input parameters to the method and small changes in code.
$start - from that number we start
$total - max number
$step - increment by $step
$extra - additional values 50 and 100(basically these values do not needed for small lists)
$all - if set to true when the "show all" value will be added to the end of the list
public function getLimitBox($start=5, $total=30, $step=5, $extra=true, $all=true)
{
$app = JFactory::getApplication();
$limits = array();
// Make the option list.
for ($i = $start; $i <= $total; $i += $step)
{
$limits[] = JHtml::_('select.option', "$i");
}
if ($extra) {
$limits[] = JHtml::_('select.option', '50', JText::_('J50'));
$limits[] = JHtml::_('select.option', '100', JText::_('J100'));
}
if ($all) {
$limits[] = JHtml::_('select.option', '0', JText::_('JALL'));
}
$selected = $this->viewall ? 0 : $this->limit;
// Build the select list.
if ($app->isAdmin())
{
$html = JHtml::_(
'select.genericlist',
$limits,
$this->prefix . 'limit',
'class="inputbox input-mini" size="1" onchange="Joomla.submitform();"',
'value',
'text',
$selected
);
}
else
{
$html = JHtml::_(
'select.genericlist',
$limits,
$this->prefix . 'limit',
'class="inputbox input-mini" size="1" onchange="this.form.submit()"',
'value',
'text',
$selected
);
}
return $html;
}
Is it possible to include these fixes in future releases of Joomla?PS! And it maybe we need an array as $extra so we could build list of values via for() ?