Hello everyone, I was wondering if anyone can shed some light on a slight issue I'm having with pagination. I can't get to seem to make the same method I used before (vb 4.1.4) work with 4.1.5 pl1 adding pagination to content. Did anything change??
I am using this code for the pagination and results:
PHP Code:
$vbulletin->input->clean_array_gpc('r', array(
'perpage' => TYPE_UINT,
'pagenumber' => TYPE_UINT,
));
$cel_users = $db->query_first("
SELECT COUNT('edition') AS users_count
FROM cotw_aotw_hall_of_fame
");
sanitize_pageresults($cel_users['users_count'], $pagenumber, $perpage, 60, 3);
if ($vbulletin->GPC['pagenumber'] < 1)
{
$vbulletin->GPC['pagenumber'] = 1;
}
else if ($vbulletin->GPC['pagenumber'] > ceil(($cel_users['users_count'] + 1) / $perpage))
{
$vbulletin->GPC['pagenumber'] = ceil(($cel_users['users_count'] + 1) / $perpage);
}
$limitlower = ($vbulletin->GPC['pagenumber'] - 1) * $perpage;
$limitupper = ($vbulletin->GPC['pagenumber']) * $perpage;
$pagenav = construct_page_nav(
$vbulletin->GPC['pagenumber'],
$perpage,
$cel_users['users_count'],
'cotw_aotw_hall_of_fame.php?' . $vbulletin->session->vars['sessionurl'], // the pagenav-link
'', // to pass a second portion or the pagenav-link, gets directly appended to above
'', // to pass an anchor
'', // SEO-Link for thread, forum, member... pages - make the pagenav-links seo'ed if you use the paginator on one of those
'', // Array to pass linkinfo for SEO-Link-Method
'' // Array to pass additional Info for SEO-Link-Method
);
$result = $db->query_read("SELECT * FROM cotw_aotw_hall_of_fame ORDER BY edition DESC LIMIT $limitlower, $perpage");
if (mysql_num_rows($result) > 0) {
// yes
// print them one after another
echo "<center><table style=margin-top:5px;>";
while($row = mysql_fetch_row($result)) {
echo "<tr>";
echo "<td><center><u style=color:#417394;font-size:20px;><b style=color:#417394;>Avatar Of The Week Edition # ".$row[7]." </b></u></center>";
echo "<center>Won With ".$row[2]." Votes</center>";
echo "<center>Nominated By: <b style=color:#3B81B7;><a href=".$vbulletin->options['bburl']."/member.php?".$row[6]."-".$row[4].">".$row[4]." </a></b></center>";
echo "<center>Added: ".date("F j, Y g:i a", strtotime($row[3]))."</center>";
echo "<center>Created By: ".$row[5]."</center></td>";
echo "<td><center><img src =".$row[1]." style=padding-bottom:5px></center></td>";
echo "</tr>";
}
echo "</table></center>";
}
else {
// no
// print status message
echo "No Contests Have Been Started.";
}
Adding these lines to my page to render the pagination:
PHP Code:
$templater->register('pagenav', $pagenav);
$templater->register('pagenumber', $pagenumber);
$templater->register('perpage', $perpage);
And using this HTML is my template to show the pagination navigation:
HTML Code:
<vb:if condition="$pagenav">
<div id="pagination_top" style="float: right; margin-bottom: 27px; margin-right: 5px;">
<center>{vb:raw pagenav}</center>
</div>
</vb:if>
Any ideas anyone??
Best Regards.
EDITED: The pagination works because i is only showing the results I specified but the actual pagination navigation does not show in the page.