views:

54

answers:

1

Hello,

Im using Drupal 6.x. In my page i have the following code which prints a paged table.

$headers = array(array('data' => t('Node ID'),'field' => 'nid','sort'=>'asc' ),
        array('data' => t('Title'),'field' => 'title'),
      );


print theme('pager_table','SELECT nid,title FROM {node_revisions}', 5, $headers );

Is there a way i can pass the rows of a table as an array to the theme function ?

Please Help Thank You.

+1  A: 

I don't know theme_pager_table, it's not a part of Drupal core. What you can do, it to wrap your sql in pager_query(), then you can loop through your results and create the table rows like normal. pager_query() will handle adding the LIMIT and OFFSET in the query.

Doing this you cam use the normal theme_table and just add the pager with theme_pager. (Remember to use the theme, wrapper function instead of calling the theme functions directly)

googletorp