mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/10968] Render pagination within the template
Since phpBB 2 pagination has been rendered mostly within the source. This limits just what designers can do with pagination. The current form is also questionable in terms of "best practice". The aim is to move rendering completely to the template via the use of a block element. Enabling S_ template vars also allows for control over specific aspects of the pagination output such as next, previous, active and ellipsis. Related to this - merging the capabilities of the topic_generate_pagination with generate_pagination removes an element of duplication. PHPBB3-10968
This commit is contained in:
@@ -639,48 +639,6 @@ function get_forum_parents(&$forum_data)
|
||||
return $forum_parents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate topic pagination
|
||||
*/
|
||||
function topic_generate_pagination($replies, $url)
|
||||
{
|
||||
global $config, $user;
|
||||
|
||||
// Make sure $per_page is a valid value
|
||||
$per_page = ($config['posts_per_page'] <= 0) ? 1 : $config['posts_per_page'];
|
||||
|
||||
if (($replies + 1) > $per_page)
|
||||
{
|
||||
$total_pages = ceil(($replies + 1) / $per_page);
|
||||
$pagination = '';
|
||||
|
||||
$times = 1;
|
||||
for ($j = 0; $j < $replies + 1; $j += $per_page)
|
||||
{
|
||||
$pagination .= '<a href="' . $url . ($j == 0 ? '' : '&start=' . $j) . '">' . $times . '</a>';
|
||||
if ($times == 1 && $total_pages > 5)
|
||||
{
|
||||
$pagination .= '<span class="page-dots"> ... </span>';
|
||||
|
||||
// Display the last three pages
|
||||
$times = $total_pages - 3;
|
||||
$j += ($total_pages - 4) * $per_page;
|
||||
}
|
||||
else if ($times < $total_pages)
|
||||
{
|
||||
$pagination .= '<span class="page-sep">' . $user->lang['COMMA_SEPARATOR'] . '</span>';
|
||||
}
|
||||
$times++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$pagination = '';
|
||||
}
|
||||
|
||||
return $pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain list of moderators of each forum
|
||||
*/
|
||||
|
Reference in New Issue
Block a user