[drupal-devel] [bug] Clean up pager code
kbahey
drupal-devel at drupal.org
Tue May 24 01:19:55 UTC 2005
Issue status update for http://drupal.org/node/23495
Project: Drupal
Version: cvs
Component: base system
Category: bug reports
Priority: normal
Assigned to: Steven
Reported by: Steven
Updated by: kbahey
Status: patch
"I hardly think anyone would link to a specific pager page.
"
Not humans perhaps, but search engines would for sure.
Now this will cause 404.
This does not mean I am against the change. It makes sense. Just
pointing out a potential consequence.
kbahey
Previous comments:
------------------------------------------------------------------------
May 23, 2005 - 19:54 : Steven
Attachment: http://drupal.org/files/issues/pager_1.patch (20.22 KB)
FactoryJoe recently asked me about theming the pager. Looking at the
code, I decided it was way too much uncommented voodoo. So here's the
cleanup patch.
The biggest change is that before this patch, the pager would count
items. When there are 5 items per page, the urls would go from=0,
from=5, from=10, etc. The code also handled in between values, e.g.
from=2 or from=13. IMO this 'in between' feature is useless (you can
only use it by typing in the url yourself, and once you do the pager
remembers the in-page offset) and it complicates the code.
Instead of this, I made the pager count page numbers. 'from' is simply
an integer per pager: 0, 1, 2, 3... This makes the code simpler. I also
commented it some more, and cleaned up some inconsistencies in the code.
Finally, the code had a lot of (int) casts in it. Most of these were
unnecessary as the variable was either the result of a calculation, or
used in a calculation. I got rid of those that had no effect.
Functionally, nothing changes except the meaning of "from" in the pager
URLs. I hardly think anyone would link to a specific pager page.
More information about the drupal-devel
mailing list