データベースからのデータを含むテーブルがあり、ページャーが必要です。他のサイトの例 (buildamodule.com の) のすべてのコードがあり、テーブルはレンダリングされますが、生成されません。ページャー、制限よりも多くの行がありますが:
関数:
function get_loyaltycodes(){
$headers = array(
array(
'data' => t('Code')
),
array(
'data' => t('Info')
),
array(
'data' => t('Points')
),
array(
'data' => t('Consumed by')
),
);
$limit = variable_get('codes_per_page',5);
$query = db_select('loyalty_codes','lc');
$query -> fields('lc',array('code','info','points','uid'))
-> orderBy('lc.info','ASC')
-> extend('PagerDefault')
-> limit($limit);
//to see all codes for a certain amount of points, just append the number of points to the URL
$arg = arg(2);
if($arg != '' && is_numeric($arg))
{
$query->condition('points', $arg);
}
// Fetch the result set.
$result = $query->execute();
$rows = array();
// Loop through each item and add to the $rows array.
foreach ($result as $row) {
$rows[] = array(
$row->code,
$row->info,
$row->points,
$row->uid,
);
}
// Format output.
$output = theme('table', array('header' => $headers, 'rows' => $rows)) . theme('pager');
return $output;
$limit 変数は設定フォームで 5 に設定されており、データベースでも 5 です。
ページャーが表示されない理由を知っている人はいますか? おそらく出力のフォーマットに何か?
助けていただければ幸いです。