Pagging with array content
beautifulmind - May 1, 2008 - 13:30
Does any one have idea about how to apply pagging on array content?
It works perfectly when using the foreach(), but with while(), its not showing next pages, and just sticks with the first page.
If you can get this, please share your idea.
Thank you.
Beautifulmind
Know more

My opinion is that it would
My opinion is that it would be more likely to get help from someone if you showed us the code with the problematic while().
Thanks for replying. the
Thanks for replying.
the code is as follows:
$start_form = $_GET['page'] ? $_GET['page'] : 0;
$total_entries = 0;
$page_increment = 50;
$dispalyed_count = 0;
$am__node_id = array();
$output = NULL;
$om__term = taxonomy_get_term($sn__tid);
$om__parent = array_shift(taxonomy_get_parents($om__term->tid));
$ss__title_text = $om__parent->name .' - '. $om__term->name ." - ".
t("Vinkit");
drupal_set_title($ss__title_text);
$r__result = db_query("SELECT n.nid FROM {node} n INNER JOIN {term_node}
tn ON n.nid = tn.nid WHERE n.type = 'tips' AND tn.tid = %d
AND n.status = 1 ORDER BY n.created DESC", $om__term->tid);
$output = "<div class='m_listH'><h1>". t("RECENT TIPS") ."</h1><ul>";
while ($om__node_id = db_fetch_object($r__result)) {
$total_entries++;
$node = node_load($om__node_id->nid);
if (($start_from && ($start_from * $page_increment) >= $total_entries) ||
($displayed_count == $page_increment)) {
continue;
}
$output .= "<li><span>". l($om__term->name,
'destination_page/'. $om__term->tid) ."</span>".
l($node->title, 'destination_page/view_tips/'. $om__term->tid
.'/'. $node->nid) ."</li>";
$displayed_count++;
}
$GLOBALS['pager_page_array'][] = $start_from;
$GLOBALS['pager_total'][] = intval($total_entries / $page_increment) + 1;
$output .= '</ul></div>';
if ($total_entries >= $page_increment) {
$output .= theme('pager', NULL, $page_increment);
}
return $output ;
Beautifulmind
Know more