Limit the limit drop down box in the search results page (feature request #0000910) HEAD
authorSami Barakat <sami@sbarakat.co.uk>
Thu Nov 05 00:43:55 2009 +0000 (3 months ago)
branchHEAD
changeset 7438af60253641ad
parent 743737aac60623c4
child 743957bcdd15e6d4
Limit the limit drop down box in the search results page (feature request #0000910)
system/classes/listfactory.class.php
     1.1 --- a/system/classes/listfactory.class.php	Wed Nov 04 13:00:40 2009 +0100
     1.2 +++ b/system/classes/listfactory.class.php	Thu Nov 05 00:43:55 2009 +0000
     1.3 @@ -614,11 +614,28 @@
     1.4  
     1.5                  $selected = $this->_per_page == $val ? ' selected="selected"' : '';
     1.6  
     1.7 +                // Prevent displaying too many limit items
     1.8 +                if ($this->_total_found <= $val)
     1.9 +                {
    1.10 +                    // If this is the last item, chances are its going to be selected
    1.11 +                    $selected = $this->_per_page >= $val ? ' selected="selected"' : '';
    1.12 +                    $list_templates->set_var('limit_href', $href);
    1.13 +                    $list_templates->set_var('limit_text', $text);
    1.14 +                    $list_templates->set_var('limit_selected', $selected);
    1.15 +                    $list_templates->parse('page_limit', 'limit', true);
    1.16 +
    1.17 +                    break;
    1.18 +                }
    1.19 +
    1.20 +                $selected = $this->_per_page == $val ? ' selected="selected"' : '';
    1.21                  $list_templates->set_var('limit_text', $text);
    1.22                  $list_templates->set_var('limit_href', $href);
    1.23                  $list_templates->set_var('limit_selected', $selected);
    1.24                  $list_templates->parse('page_limit', 'limit', true);
    1.25              }
    1.26 +            if (empty($text)) {
    1.27 +                $list_templates->set_var('show_limit', 'display:none;');
    1.28 +            }
    1.29          }
    1.30          else
    1.31          {