vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   how do I use the function construct_page_nav()?? (https://vborg.vbsupport.ru/showthread.php?t=113049)

DrewM 04-14-2006 11:24 PM

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!

RS_Jelle 04-15-2006 01:08 PM

It's explained in this tutorial ;)

DrewM 04-15-2006 02:23 PM

this is not in that tutorial.

DrewM 04-16-2006 05:19 PM

bump also I know this is in A tutorial but I was hoping for then in the tutorial

Adrian Schneider 04-16-2006 05:28 PM

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.

akanevsky 04-16-2006 07:34 PM

I suggest you look in functions.php for the definition of the function.

DrewM 04-16-2006 08:31 PM

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!

DrewM 04-17-2006 08:32 PM

bump

DrewM 04-19-2006 10:33 AM

bump

DrewM 04-20-2006 11:16 AM

;bump;


All times are GMT. The time now is 09:24 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.01750 seconds
  • Memory Usage 1,773KB
  • 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
  • (6)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete