mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/12153] Assign PAGE_NUMBER in pagination.generate_template_pagination()
PHPBB3-12153
This commit is contained in:
parent
d50b8df364
commit
06e9959648
1 changed files with 90 additions and 91 deletions
|
@ -76,14 +76,11 @@ class pagination
|
||||||
public function generate_template_pagination($base_url, $block_var_name, $start_name, $num_items, $per_page, $start = 1, $reverse_count = false, $ignore_on_page = false)
|
public function generate_template_pagination($base_url, $block_var_name, $start_name, $num_items, $per_page, $start = 1, $reverse_count = false, $ignore_on_page = false)
|
||||||
{
|
{
|
||||||
$total_pages = ceil($num_items / $per_page);
|
$total_pages = ceil($num_items / $per_page);
|
||||||
|
|
||||||
if ($total_pages == 1 || !$num_items)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$on_page = $this->get_on_page($per_page, $start);
|
$on_page = $this->get_on_page($per_page, $start);
|
||||||
|
$u_previous_page = $u_next_page = '';
|
||||||
|
|
||||||
|
if ($total_pages > 1)
|
||||||
|
{
|
||||||
if ($reverse_count)
|
if ($reverse_count)
|
||||||
{
|
{
|
||||||
$start_page = ($total_pages > 5) ? $total_pages - 4 : 1;
|
$start_page = ($total_pages > 5) ? $total_pages - 4 : 1;
|
||||||
|
@ -178,6 +175,7 @@ class pagination
|
||||||
'S_IS_ELLIPSIS' => false,
|
'S_IS_ELLIPSIS' => false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If the block_var_name is a nested block, we will use the last (most
|
// If the block_var_name is a nested block, we will use the last (most
|
||||||
// inner) block as a prefix for the template variables. If the last block
|
// inner) block as a prefix for the template variables. If the last block
|
||||||
|
@ -203,6 +201,7 @@ class pagination
|
||||||
'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $u_next_page : '',
|
'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $u_next_page : '',
|
||||||
$tpl_prefix . 'TOTAL_PAGES' => $total_pages,
|
$tpl_prefix . 'TOTAL_PAGES' => $total_pages,
|
||||||
$tpl_prefix . 'CURRENT_PAGE' => $on_page,
|
$tpl_prefix . 'CURRENT_PAGE' => $on_page,
|
||||||
|
$tpl_prefix . 'PAGE_NUMBER' => $this->on_page($base_url, $num_items, $per_page, $start),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($tpl_block_name)
|
if ($tpl_block_name)
|
||||||
|
|
Loading…
Add table
Reference in a new issue