global $pref; @include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_np.php"); @include_once(e_LANGUAGEDIR."English/lan_np.php"); $parm_count = substr_count($parm, ","); while($parm_count < 5) { $parm .= ","; $parm_count++; } $p = explode(",", $parm, 6); $total_items = intval($p[0]); $perpage = intval($p[1]); $current_start = intval($p[2]); $url = trim($p[3]); $caption = trim($p[4]); $pagetitle = explode("|",trim($p[5])); if($total_items < $perpage) { return ""; } $caption = (!$caption || $caption == "off") ? NP_3." " : $caption; while(substr($url, -1) == ".") { $url=substr($url, 0, -1); } $current_page = ($current_start/$perpage) + 1; $total_pages = ceil($total_items/$perpage); if($total_pages > 1) { if(isset($pref['old_np']) && $pref['old_np']) { $NP_PRE_ACTIVE = ""; $NP_POST_ACTIVE = ""; $NP_STYLE = ""; if(!defined("NEXTPREV_NOSTYLE") || NEXTPREV_NOSTYLE==FALSE){ $NP_PRE_ACTIVE = "["; $NP_POST_ACTIVE = "] "; $NP_STYLE = "style='text-decoration:underline'"; } // Use OLD nextprev method $nppage = ''; $nppage .= "\n\n\n\n"; if ($total_pages > 10) { $current_page = ($current_start/$perpage)+1; for($c = 0; $c <= 2; $c++) { if($perpage * $c == $current_start) { $nppage .= $NP_PRE_ACTIVE."".($c+1)."".$NP_POST_ACTIVE."\n"; } else { $link = str_replace("[FROM]", ($perpage * $c), $url); $nppage .= "".($c+1)." \n"; } } if ($current_page >= 3 && $current_page <= 5) { for($c = 3; $c <= $current_page; $c++) { if($perpage * $c == $current_start) { $nppage .= $NP_PRE_ACTIVE."".($c+1)."".$NP_POST_ACTIVE."\n"; } else { $link = str_replace("[FROM]", ($perpage * $c), $url); $nppage .= "".($c+1)." \n"; } } } else if($current_page >= 6 && $current_page <= ($total_pages-5)) { $nppage .= " ... "; for($c = ($current_page-2); $c <= $current_page; $c++) { if($perpage * $c == $current_start) { $nppage .= $NP_PRE_ACTIVE."".($c+1)."".$NP_POST_ACTIVE."\n"; } else { $link = str_replace("[FROM]", ($perpage * $c), $url); $nppage .= "".($c+1)." \n"; } } } $nppage .= " ... "; if (($current_page+5) > $total_pages && $current_page != $total_pages) { $tmp = ($current_page-2); } else { $tmp = $total_pages-3; } for($c = $tmp; $c <= ($total_pages-1); $c++) { if($perpage * $c == $current_start) { $nppage .= $NP_PRE_ACTIVE."".($c+1)."".$NP_POST_ACTIVE."\n"; } else { $link = str_replace("[FROM]", ($perpage * $c), $url); $nppage .= "".($c+1)." \n"; } } } else { for($c = 0; $c < $total_pages; $c++) { if($perpage * $c == $current_start) { $nppage .= $NP_PRE_ACTIVE."".($c+1)."".$NP_POST_ACTIVE."\n"; } else { $link = str_replace("[FROM]", ($perpage * $c), $url); $nppage .= "".($c+1)." \n"; } } } $nppage .= "\n\n\n\n"; return $caption.$nppage; } // Use NEW nextprev method $np_parm['template'] = "[PREV]  [DROPDOWN]  [NEXT]"; $np_parms['prev'] = "  <<  "; $np_parms['next'] = "  >>  "; $np_parms['np_class'] = 'tbox npbutton'; $np_parms['dropdown_class'] = 'tbox npdropdown'; if($cached_parms = getcachedvars('nextprev')) { $tmp = $cached_parms; foreach($tmp as $key => $val) { $np_parms[$key]=$val; } } $prev=""; $next=""; if($current_page > 1) { $prevstart = ($current_start - $perpage); $link = str_replace("[FROM]", $prevstart, $url); $prev = "{$np_parms['prev']}"; } if($current_page < $total_pages) { $nextstart = ($current_start + $perpage); $link = str_replace("[FROM]", $nextstart, $url); $next = "{$np_parms['next']}"; } $dropdown = ""; $ret = $np_parm['template']; $ret = str_replace('[DROPDOWN]', $dropdown, $ret); $ret = str_replace('[PREV]', $prev, $ret); $ret = str_replace('[NEXT]', $next, $ret); return $caption.$ret; } return "";