I was working on the z3950 module, which implements hook_search to display content from z39.50 (library) servers. The results being displayed aren't from a Drupal database, so pager_query() can't be used. But, there are lots of results, that can be chunked into pages, and thus should use the Drupal paging system.

The attached patch slightly refactors pager_query, keeping the original functionality intact, but exposes a new function called pager_init() which can be used by contrib modules.

Comments

douggreen’s picture

StatusFileSize
new2.02 KB

... removing one extraneous line in patch file

moshe weitzman’s picture

i once did this without a patch: http://cvs.drupal.org/viewvc.py/drupal/contributions/tricks/pager_withou.... that might have bit rotted since then. maybe this patch is useful still - i dunno.

douggreen’s picture

Yes, it can be done without a patch. I'm just proposing some refactoring so that we get a new API function that makes it easier to do. Compared to your "trick" solution, what you get by using the pager call is an additional calculations on page position.

bdragon’s picture

StatusFileSize
new2.08 KB

Reroll from root.
D7 fodder?
Reroll brought to you by patch bingo.

pancho’s picture

Version: 6.x-dev » 7.x-dev

If it can be done without API changes, I guess it will be something for D7...

lilou’s picture

Patch still applied.

cburschka’s picture

Why is testbot not testing this?

I like it muchly - reinventing pagers just because you are not using a database query is annoying.

lilou’s picture

StatusFileSize
new2.15 KB

* Coding standard correction in comments.
* Add NULL default argument for $count in pager_init()

catch’s picture

Status: Needs review » Needs work

Needs updating for dbtng - db_result() is deprecated.

netw3rker’s picture

Version: 7.x-dev » 6.x-dev
Issue summary: View changes
Status: Needs work » Closed (won't fix)

This was a D6 issue that got punted to a D7 feature request. It looks to have been implemented via a different set of issues and patches though. I think its safe to say this is closed since the functionality described in the OP and patches is clearly implemented in D7. See here for reference:

https://api.drupal.org/api/drupal/includes%21pager.inc/function/pager_de...

feel free to reopen this issue if that is not adequate going forward!