[geeklog-cvs] geeklog: Limit the limit drop down box in the search results pag...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Wed Nov 4 19:56:14 EST 2009


changeset 7438:af60253641ad
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/af60253641ad
user: Sami Barakat <sami at sbarakat.co.uk>
date: Thu Nov 05 00:43:55 2009 +0000
description:
Limit the limit drop down box in the search results page (feature request #0000910)

diffstat:

 system/classes/listfactory.class.php |  17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diffs (32 lines):

diff -r 37aac60623c4 -r af60253641ad system/classes/listfactory.class.php
--- a/system/classes/listfactory.class.php	Wed Nov 04 13:00:40 2009 +0100
+++ b/system/classes/listfactory.class.php	Thu Nov 05 00:43:55 2009 +0000
@@ -614,11 +614,28 @@
 
                 $selected = $this->_per_page == $val ? ' selected="selected"' : '';
 
+                // Prevent displaying too many limit items
+                if ($this->_total_found <= $val)
+                {
+                    // If this is the last item, chances are its going to be selected
+                    $selected = $this->_per_page >= $val ? ' selected="selected"' : '';
+                    $list_templates->set_var('limit_href', $href);
+                    $list_templates->set_var('limit_text', $text);
+                    $list_templates->set_var('limit_selected', $selected);
+                    $list_templates->parse('page_limit', 'limit', true);
+
+                    break;
+                }
+
+                $selected = $this->_per_page == $val ? ' selected="selected"' : '';
                 $list_templates->set_var('limit_text', $text);
                 $list_templates->set_var('limit_href', $href);
                 $list_templates->set_var('limit_selected', $selected);
                 $list_templates->parse('page_limit', 'limit', true);
             }
+            if (empty($text)) {
+                $list_templates->set_var('show_limit', 'display:none;');
+            }
         }
         else
         {



More information about the geeklog-cvs mailing list