vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Did any changes occur in how content pagination works in vb 4.1.5? (https://vborg.vbsupport.ru/showthread.php?t=268419)

EquinoxWorld 08-12-2011 12:20 PM

Did any changes occur in how content pagination works in vb 4.1.5?
 
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$perpage603);

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:

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.

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

Quote:

Originally Posted by Lynne (Post 2232627)
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. :)


All times are GMT. The time now is 04:59 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01497 seconds
  • Memory Usage 1,755KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete