function makepagenav($start, $count, $total, $range = 0, $link = "") {
global $locale;
if ($link == "") { $link = FUSION_SELF."?"; }
$pg_cnt = ceil($total / $count);
if ($pg_cnt <= 1) { return ""; }
$idx_back = $start - $count;
$idx_next = $start + $count;
$cur_page = ceil(($start + 1) / $count);
$res = $locale['global_092']." ".$cur_page.$locale['global_093'].$pg_cnt.": ";
if($idx_back >= 0) {
[color=#ff0000] if ($cur_page > ($range + 1)) {
$res .= "<a href='".$link."rowstart=0'>1</a>";
if ($cur_page != ($range + 2)) {
$res .= "...";
}
}[/color]
}
$idx_fst = max($cur_page - $range, 1);
$idx_lst = min($cur_page + $range, $pg_cnt);
if ($range == 0) {
$idx_fst = 1;
$idx_lst = $pg_cnt;
}
for ($i = $idx_fst; $i <= $idx_lst; $i++) {
$offset_page = ($i - 1) * $count;
if ($i == $cur_page) {
$res .= "<span><strong>".$i."</strong></span>";
} else {
$res .= "<a href='".$link."rowstart=".$offset_page."'>".$i."</a>";
}
}
if ($idx_next < $total) {
[color=#ff0000] if ($cur_page < ($pg_cnt - $range)) {
if ($cur_page != ($pg_cnt - $range - 1)) {
$res .= "...";
}
$res .= "<a href='".$link."rowstart=".($pg_cnt - 1) * $count."'>".$pg_cnt."</a>\n";
}[/color]
}
return "<div class='pagenav'>\n".$res."</div>\n";
}
Category Forum
Suspected Bugs and Errors - 8Labels
None yet
Statistics
5 participants
Notifications
You are not receiving notifications from this thread.
Related Questions