mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 06:13:58 -07:00
Minor improvements (#816)
This commit is contained in:
parent
ed270566b6
commit
084d567543
1 changed files with 5 additions and 27 deletions
|
@ -1184,35 +1184,10 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
|
||||||
{
|
{
|
||||||
global $lang, $template;
|
global $lang, $template;
|
||||||
|
|
||||||
// Pagination Mod
|
|
||||||
$begin_end = 3;
|
$begin_end = 3;
|
||||||
$from_middle = 1;
|
$from_middle = 1;
|
||||||
/*
|
|
||||||
By default, $begin_end is 3, and $from_middle is 1, so on page 6 in a 12 page view, it will look like this:
|
|
||||||
|
|
||||||
a, d = $begin_end = 3
|
|
||||||
b, c = $from_middle = 1
|
|
||||||
|
|
||||||
"begin" "middle" "end"
|
|
||||||
| | |
|
|
||||||
| a b | c d |
|
|
||||||
| | | | | | |
|
|
||||||
v v v v v v v
|
|
||||||
1, 2, 3 ... 5, 6, 7 ... 10, 11, 12
|
|
||||||
|
|
||||||
Change $begin_end and $from_middle to suit your needs appropriately
|
|
||||||
*/
|
|
||||||
|
|
||||||
$total_pages = ceil($num_items / $per_page);
|
$total_pages = ceil($num_items / $per_page);
|
||||||
|
|
||||||
if ($total_pages == 1 || $num_items == 0) {
|
|
||||||
$template->assign_vars(array(
|
|
||||||
'PAGINATION' => false,
|
|
||||||
));
|
|
||||||
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$on_page = floor($start_item / $per_page) + 1;
|
$on_page = floor($start_item / $per_page) + 1;
|
||||||
|
|
||||||
$page_string = '';
|
$page_string = '';
|
||||||
|
@ -1268,8 +1243,11 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$pagination = ($page_string) ? '<a class="menu-root" href="#pg-jump">' . $lang['GOTO_PAGE'] . '</a> : ' . $page_string : '';
|
$pagination = false;
|
||||||
|
if ($page_string && $total_pages > 1) {
|
||||||
|
$pagination = '<a class="menu-root" href="#pg-jump">' . $lang['GOTO_PAGE'] . '</a> : ' . $page_string;
|
||||||
$pagination = str_replace('&start=0', '', $pagination);
|
$pagination = str_replace('&start=0', '', $pagination);
|
||||||
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'PAGINATION' => $pagination,
|
'PAGINATION' => $pagination,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue