[drupal-devel] [bug] Clean up pager code

kbahey drupal-devel at drupal.org
Tue May 24 03:15:44 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

What I mean is that sites will already have from=25, from=50, ...etc.
indexed in Google and other search engines. So these pages are
bookmarked in a way, though not by humans.


These will now give a 404 (at least some of them) if someone clicks on
the old links.




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.




------------------------------------------------------------------------

May 23, 2005 - 20:19 : kbahey

"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.




------------------------------------------------------------------------

May 23, 2005 - 22:05 : Steven

I'm not sure what you mean... a search engine can simply spider out the
new indices like any other page change.


In fact, now the from numbers are sequential, a really smart search
engine might take advantage of that ;).







More information about the drupal-devel mailing list