PDA

View Full Version : Did any changes occur in how content pagination works in vb 4.1.5?


EquinoxWorld
08-12-2011, 12:20 PM
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:



$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 #&nbsp;".$row[7]."&nbsp;</b></u></center>";
echo "<center>Won With&nbsp;".$row[2]."&nbsp;Votes</center>";
echo "<center>Nominated&nbsp;By:&nbsp;<b style=color:#3B81B7;><a href=".$vbulletin->options['bburl']."/member.php?".$row[6]."-".$row[4].">".$row[4]."&nbsp;</a></b></center>";
echo "<center>Added:&nbsp;".date("F j, Y g:i a", strtotime($row[3]))."</center>";
echo "<center>Created By:&nbsp;".$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:


$templater->register('pagenav', $pagenav);
$templater->register('pagenumber', $pagenumber);
$templater->register('perpage', $perpage);


And using this HTML is my template to show the pagination navigation:


<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.

Lynne
08-12-2011, 01:51 PM
Can we get a link to the page? And what do you mean the "pagination works" but then you say the "pagination navigation does not show"?

EquinoxWorld
08-12-2011, 04:38 PM
Can we get a link to the page? And what do you mean the "pagination works" but then you say the "pagination navigation does not show"?

Thanks for your reply Lynne, turns out it does work; what was happening was since I have more than one page using pagination I was using $pagenav and $perpage in both so it was causing some sort of variable overlap if you will. I simply added a 2 to each variable to differentiate them and they both work fine now. For future reference if anyone has any trouble with adding custom pagination to more than one page be sure to use unique variables for $pagenav and $perpage (all throught your code). I do apologize for the waste of thread. :)

P.S. What I meant before was that the content was being reduced down to the $perpage variable but the actual navigation of the pagination was not showig.

Lynne
08-12-2011, 11:47 PM
Glad you got it working. :)