[drupal-devel] Question on use of theme_pager() and related functions

Syscrusher scott at 4th.com
Tue May 3 17:06:07 UTC 2005

On Tuesday 03 May 2005 12:39, Axel Kollmorgen wrote:
> > I'm trying to use this function, and I've actually got it working except for
> > one issue: I don't know how to tell it the actual number of rows that were
> > returned from my database query.
> what do you need that "actual number of rows that were returned from my 
> database query" for? the meaning of theme_pager() is to split an 
> resultset of x rows into pages of $limit rows.

It's not that *I* need it, but rather that theme_pager() needs it and
doesn't seem to be getting it. I can retrieve it easily from db_num_rows().

I wasn't aware of the global variable, but someone pointed it out to me
off list. So now I just need to trace and find out why it's not getting
set. When I wasn't aware it existed, I was on a wild goose chase looking
for some trick in the parameters that was supposed to pass this data. :-)

> if you really really need the total number of rows, check
>    global $pager_total;
> init'ed in pager_query(), used in theme_pager().

That's where I'm headed next.

> > I see the "tags" array that can be passed, and it *looks* as if that would
> > be the right thing to do.
> no - the $tags param is used change the pager strings 'first page', 
> 'previous page', 'next page', and 'last page'.

Mea culpa -- I figured that out right after I posted to the list (isn't that
always the way?).

Time to dive into that global variable. My table only has two rows *total*,
so there's no way the pager should be thinking 900+. I'm doing something bogus


Scott Courtney     Drupal user name: "syscrusher"   http://drupal.org/user/9184
scott at 4th dot com       Drupal projects: http://drupal.org/project/user/9184
Sandbox:  http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/syscrusher

More information about the drupal-devel mailing list