function _shipingzhongmymodule_test_pager_callback () {
header("Content-type: text/html");
header("Expires: Wed, 29 Jan 1975 04:15:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
//Create a list of headers for your Html table (see Drupal 7 docs for theme_table here:
http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_table/7 $header = array(
array('data' => 'Title', 'field' => 'title', 'sort' => 'asc'),
array('data' => 'Node ID', 'field' => 'nid'),
array('data' => 'Type', 'field' => 'type'),
array('data' => 'Created', 'field' => 'created'),
array('data' => 'Published'),
);
//Create the Sql query. This uses various parts of Drupal 7's new DBTNG database abstraction layer. See these links for details:
//Dynamic queries:
http://drupal.org/node/310075 //Extenders:
http://drupal.org/node/508796 //Table sort:
http://drupal.org/node/310075#table_sort $sql = "select title,nid,type,created,changed from {node} where status=1 limit 0,10";
$sql_count = "select count(nid) as nid from {node} where status=1";
$result = db_query($sql);
$rows = array();
while ($row = db_fetch_array($result)) {
$rows[]=$row;
}
//Theme the html table:
http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_table/7 $data = theme('table', $header,$rows);
//Append pager:
http://api.drupal.org/api/drupal/includes--pager.inc/function/theme_pager// $html .= theme('pager',
// array(
// 'tags' => array()
// )
// );
die ($data);
}