$n = 1140;
$t = 'image';
$previous=0;
$next=0;
$tmp_prev=-1;
$terms = taxonomy_node_get_terms_by_vocabulary($n, _image_gallery_get_vid());
if ($terms) {
$term = array_pop($terms);
$res = db_query("SELECT n.nid FROM {term_node} t, {node} n WHERE t.tid=$term->tid AND n.nid=t.nid ORDER BY n.title ASC”);
$tot_num = db_num_rows($res);
for($i=0;$i<$tot_num;$i++) {
$nidvalue=db_result($res,$i);
if($previous!=0 && $next==0) {
$next=$nidvalue;
}
if($nidvalue == intval($n)) {
$previous=$tmp_prev;
}
$tmp_prev=$nidvalue;
}
$prev_node = node_load($previous);
$next_node = node_load($next);
$prev_th = l(image_display($prev_node, 'thumbnail', array()),'node/'.$prev_node->nid, array(), null, null, FALSE, TRUE);
$next_th = l(image_display($next_node, ‘thumbnail’, array()),’node/’.$next_node->nid, array(), null, null, FALSE, TRUE);
$output = ”;
$output .= ‘
| ‘ . $prev_th . ‘ | ‘ . $next_th . ‘ | ‘ . $tot_num . ‘ photos in this album. |
‘;
print $output;
}
?>