$query = db_select('node', 'n');
$query = $query->condition('n.type', 'article', '=')
  ->fields('n', array('nid', 'title', 'uid'))
  ->extend('PagerDefault') 
  ->limit(1);

$result = $query->execute();
while($record = $result->fetchObject()) {
        echo $record ->title."<br/>";
    }

    echo theme('pager');
    

put the code in page--node--3.tpl.php there is a pager under the title. but when i put the same code in

page--taxonomy.tpl.php
the title outputs ok but there is no pager,why?

ps:if there is a term id, the pager will disappear.what's a werid thing!

Comments

mehul.shah’s picture

$query = db_select('node', 'n')->extend('PagerDefault')->limit(30);
$query = $query->condition('n.type', 'article', '=')
  ->fields('n', array('nid', 'title', 'uid'))
  ->extend('PagerDefault') 
  ->limit(1);

$result = $query->execute();
while($record = $result->fetchObject()) {
        echo $record ->title."<br/>";
    }

    echo theme('pager');