Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-14-2006, 11:24 PM
DrewM DrewM is offline
 
Join Date: Oct 2005
Posts: 564
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default how do I use the function construct_page_nav()??

Well I'm tring to do paging and was wondering how to use the function construct_page_nav() to do this I saw this in a tutorial. Please help!
Reply With Quote
  #2  
Old 04-15-2006, 01:08 PM
RS_Jelle RS_Jelle is offline
 
Join Date: Jul 2005
Posts: 1,276
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's explained in this tutorial
Reply With Quote
  #3  
Old 04-15-2006, 02:23 PM
DrewM DrewM is offline
 
Join Date: Oct 2005
Posts: 564
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is not in that tutorial.
Reply With Quote
  #4  
Old 04-16-2006, 05:19 PM
DrewM DrewM is offline
 
Join Date: Oct 2005
Posts: 564
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump also I know this is in A tutorial but I was hoping for then in the tutorial
Reply With Quote
  #5  
Old 04-16-2006, 05:28 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I use a block of code like this wherever I need it:

PHP Code:
// Construct Page Navigation
$total $dmEntry->viewTotalEntries($userid$whereClause$canViewPrivate);
$url "viewblog.php?{$sID}userid=$userid";
$offset = ($vbulletin->GPC['page'] - 1) * $vbulletin->GPC['pp'];
$limit "$offset, " $vbulletin->GPC['pp'];
$pageNavigation construct_page_nav($vbulletin->GPC['page'],
    
$vbulletin->GPC['pp'],     $total,    $url'&pp=' $vbulletin->GPC['pp']
); 
You should only have to edit $total and $url for this to work. Make sure you have
PHP Code:
$vbulletin->input->clean_array_gpc('g', array(
    
'pp' => TYPE_UINT,
    
'page' => TYPE_UINT
)); 
in your code as well, and they SHOULD have default values... I use this function I wrote becuase I am lazy:
PHP Code:
defaultGPC( array(
    
'pp' => $vbulletin->options['blog_max_entry_display'],
    
'page' => 1
)); 
the function
PHP Code:
function defaultGPC($data)
{
    global 
$vbulletin;
    foreach (
$data as $key => $value)
    {
        if (!
$vbulletin->GPC[$key])
        {
            
$vbulletin->GPC[$key] = $value;
        }
    }

If you aren't lazy, then just something like this:


Then placing something like:
PHP Code:
if (!$vbulletin->GPC['page'])
{
    
$vbulletin->GPC['page'] = 1;
}
if (!
$vbulletin->GPC['pp'])
{
    
$vbulletin->GPC['pp'] = 15;

does the exact same thing.

HTML Code:
<if condition="$pageNavigation"><div align="right" style="margin-bottom: 5px">$pageNavigation</div></if>
<!-- main table -->
<if condition="$pageNavigation"><div align="right" style="margin-top: 5px">$pageNavigation</div></if>
To display it.
Reply With Quote
  #6  
Old 04-16-2006, 07:34 PM
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Posts: 3,972
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I suggest you look in functions.php for the definition of the function.
Reply With Quote
  #7  
Old 04-16-2006, 08:31 PM
DrewM DrewM is offline
 
Join Date: Oct 2005
Posts: 564
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks to both of you.

Well I have been tring to get this to work but it doesn't! I tryed to change so instaed of &page=1 i'm trting to get &pagenum=2 because with &page=1 will mess up my site and it shows al the resaults on on page this is my code:
PHP Code:
if ($_REQUEST['page'] == 'news')  
{  
    
$news1 $db->query_read("SELECT * FROM " TABLE_PREFIX "site_news ORDER BY newsid DESC"); 
    while (
$news $db->fetch_array($news1)) { 
        eval(
'$rowbits .= "' fetch_template('site_v3_news_single') . '";'); 
    }

    function 
defaultGPC($data
    { 
    global 
$vbulletin
        foreach (
$data as $key => $value
        { 
            if (!
$vbulletin->GPC[$key]) 
            { 
                
$vbulletin->GPC[$key] = $value
            } 
        } 
    }  
    
$vbulletin->input->clean_array_gpc('g', array( 
    
'pp' => TYPE_UINT
    
'pagenum' => TYPE_UINT 
    
));  
    
defaultGPC( array( 
        
'pp' => 1
        
'pagenum' => 
    
));  

    
// Construct Page Navigation 
    
$total $db->num_rows($news1); 
    
$url "index.php?page=news{$sID}"
    
$offset = ($vbulletin->GPC['pagenum'] - 1) * $vbulletin->GPC['pp']; 
    
$limit "$offset, " $vbulletin->GPC['pp']; 
    
$pageNavigation construct_page_nav($vbulletin->GPC['pagenum'], 
    
$vbulletin->GPC['pp'], $total$url'&amp;pp=' $vbulletin->GPC['pp'
    );  
//templeates are here i took them out to show

PLEASe help!
Reply With Quote
  #8  
Old 04-17-2006, 08:32 PM
DrewM DrewM is offline
 
Join Date: Oct 2005
Posts: 564
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump
Reply With Quote
  #9  
Old 04-19-2006, 10:33 AM
DrewM DrewM is offline
 
Join Date: Oct 2005
Posts: 564
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump
Reply With Quote
  #10  
Old 04-20-2006, 11:16 AM
DrewM DrewM is offline
 
Join Date: Oct 2005
Posts: 564
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

;bump;
Reply With Quote
Reply


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 05:03 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.04472 seconds
  • Memory Usage 2,287KB
  • Queries Executed 11 (?)
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
  • (6)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete