I have a function mymodule_submissions in my module which fetches rows from mymodule_table and prints as table theme with pager. Its working fine if I define a menu link in my module to call that function. Pager not printing when I call the same function from a page.tpl.
function mymodule_submissions() {
$query = db_select('mymodule_table', 'uf');
$query = $query->condition('uid', $user->uid)
->fields('mytable', array('id', 'name', 'createdtime'))
->orderBy('createdtime', 'DESC')->limit(3);
$results = $query->execute();
$header = array('ID','Name','Created Time');
$rows = array();
foreach($results As $result) {
$rows[] = array( $result -> id, $result -> name, $result -> createdtime,);
}
$output .= theme('table', array('header' => $header, 'rows' => $rows,) );
$output .= theme('pager');
return $output;
}
From page.tpl, I am calling this function link below
print render(mymodule_submissions());
Anything I'm doing wrong?