Getting Results for Paged Display
results. We can do that using Drupal’s pager. Let’s grab all of the blog entries again, only this
time we’ll display them as a paged result, with links to additional pages of results and “first and
last” links at the bottom of the page.
1 2 $sql = "SELECT * FROM {node} n WHERE type = 'blog' AND status = 1 ORDER BY 3 n.created DESC" 4 $result = pager_query(db_rewrite_sql($sql), 0, 10); 5 while ($data = db_fetch_object($result)) { 6 $node = node_load($data->nid); 7 print node_view($node, TRUE); 8 } 9 // Add links to remaining pages of results. 10 print theme('pager', NULL, 10);