I would like to create a pager in the table when there is fix amount of rows.
The method suggested on internet creates table, and it fetches data by using sql query, but i want to create a table from the data from the array.
visitedgroups = array('1','2','3','4');//It is an array of node id which are group entity
$header = array(
array('data' => t('Group Name')),
array('data' => t('Group Since')),
array('data' => t('Join')),
);
$rows = array();
foreach ($visitedgroups as $groupid) {
$groupnode = node_load($groupid);
$createdtime = format_interval((time() - $groupnode->created) , 2) . t(' ago');
$joinlink = l('Join Group', 'group/node/'. $groupnode->nid.'/subscribe');
$rows[] = array( l($groupnode->title, 'node/'. $groupnode->nid),
t($createdtime),
$joinlink,
);
}
$output .= t('Recently visited groups by you, in which you are not member.');
$output .= theme('table', array('header' => $header, 'rows' => $rows, array('class' => array('group-visited-table')))).theme('pager');
The above code generates the table and working fine. But i want to add pager in the table. From the references on internet i found that people adds,
$query = $query->extend('TableSort')->extend('PagerDefault')->limit(10);
ahead of $query->execute(), but i don't have query.
So how can i apply pager in this scenario..