Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 08-12-2011, 12:20 PM
EquinoxWorld EquinoxWorld is offline
 
Join Date: Nov 2009
Location: Naples
Posts: 354
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 08-12-2011, 01:51 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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"?
Reply With Quote
  #3  
Old 08-12-2011, 04:38 PM
EquinoxWorld EquinoxWorld is offline
 
Join Date: Nov 2009
Location: Naples
Posts: 354
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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.
Reply With Quote
  #4  
Old 08-12-2011, 11:47 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Glad you got it working.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:55 PM.


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.05441 seconds
  • Memory Usage 2,218KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_html
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete