Posted by runeveryday on December 8, 2012 at 7:31am
<?php
$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
This one can help
<?php
$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');
?>
MEHUL SHAH (Your imagination is our creation)