This example shows all the information it takes to implement a simple pager.
01.
$sql
=
"SELECT nid FROM node n WHERE type = '%s' AND status = %d ORDER BY created DESC"
;
02.
$res
= pager_query(
$sql
, 5, 0, NULL,
array
(
'node_type_name'
, TRUE));
03.
04.
while
(
$res
&& (
$row
= db_fetch_array(
$res
))) {
05.
$node
= node_load(
$row
[
'nid'
]);
06.
// Display node information here
07.
}
08.
09.
echo
theme(
'pager'
);
The query can be changed easily, as long as you update pager_query() with the right arguments.
theme('pager') displays the pager widget.