1
私はデータベースからのデータを持つテーブルを持っています、私はそれがポケットベルを持っていることを望みます、私は(buildamodule.comの)例からのすべてのコードを他のサイトの中に持っていて、テーブルはレンダリングされますが、Drupal 7テーマ( '' pager '') - >テーブルはレンダリングされますが、ポケットベルはありません?
機能:
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;
$リミット変数が設定フォームで5に設定され、そしてそれは5です私は、より多くの行の制限を持っているが、ページャを生成データベースも。
ページャが表示されない理由を知っている人はいますか?おそらく、出力からフォーマットする何か?
大変助かりました!
これはチェーン内の最初の機能である必要はありません(それは私が思っていたものです)。 [この質問](http://stackoverflow.com/questions/7637279/how-do-i-get-pagerdefault-queries-to-work-correctly-with-drupal-7)に受け入れられた回答を参照してください。きれいに – Clive