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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2004, 10:34 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default vb's pagination

im trying to use vb's pagination but it isnt working
i keep getting division of by zero on line 1611 in includes/functions.php.
this is the code:
PHP Code:
    $limit=2;
    
$query_count$DB_site->query("SELECT * FROM gallery WHERE gallery_id='$id'");
    
$totalrows$DB_site->num_rows($query_count);
        if(empty(
$page)){
            
$page=1;
        }
    
sanitize_pageresults($totalrows$page$limit,100);
    
$limitlower = ($page 1) * $limit+1;
    
$limitupper = ($page) * $limit;
    if (
$limitupper $totalrows)
    {
        
$limitupper $totalrows;
        if (
$limitlower $totalrows)
        {
            
$limitlower $totalrows-$limit;
        }
    }
    if (
$limitlower <= 0)
    {
        
$limitlower 1;
    }
$fgall$DB_site->query("SELECT gallery_index.gallery_views,gallery.* FROM gallery,gallery_index WHERE gallery_index.gallery_id='$id' AND gallery.gallery_id='$id' LIMIT " . ($limitlower-1) . ",$limit $type $order");
$imagesnum=$DB_site->num_rows($fgall);
    if(
$imagesnum==0){    
    
$DB_site->query("UPDATE gallery_index SET gallery_views=gallery_views+1 WHERE gallery_id='$id'");
            
$fgalnav=$DB_site->query("SELECT gallery_index.gallery_name FROM gallery_index WHERE gallery_index.gallery_id='$id'");
            
$galnav=$DB_site->fetch_array($fgalnav);
            
$navbits = array();
            
$navbits["#"] = "Gallery";
            
$navbits["gallery.php?view=index"] = "Gallery Index";
            
$navbits[''] = $galnav[gallery_name];

            
$navbits construct_navbits($navbits);
        eval(
'$navbar = "' fetch_template('navbar') . '";');
        
mysql_free_result($fgalnav);
        eval(
'print_output("' fetch_template('gallery_gal_none') . '");');
}
else{    
    while(
$gallery$DB_site->fetch_array($fgall))
{
        if(
$gallery[image_totalvotes]==0){
            
$rating=0;
        }
        else{
            
$calcrating$gallery[image_totalrating]/$gallery[image_totalvotes];
            
$ratinground($calcrating);
        }
    
$galleryimagedate=date("m/d/Y - g:i A",$gallery[image_date]);    
    if(
$galoption[gallerybit]==1){
        eval(
'$gallerybits .= "' fetch_template('gallery_gal_lvl1alt') . '";');
    }
    else{
        eval(
'$gallerybits .= "' fetch_template('gallery_gal_lvl1') . '";');
    }    
}
    
mysql_free_result($fgall);
    
$DB_site->query("UPDATE gallery_index SET gallery_views=gallery_views+1 WHERE gallery_id='$id'");
        
$fgalnav=$DB_site->query("SELECT gallery_index.gallery_name FROM gallery_index WHERE gallery_index.gallery_id='$id'");
        
$galnav=$DB_site->fetch_array($fgalnav);
        
$navbits = array();
        
$navbits["#"] = "Gallery";
        
$navbits["gallery.php?view=index"] = "Gallery Index";
        
$navbits[''] = $galnav[gallery_name];

        
$navbits construct_navbits($navbits);
    eval(
'$navbar = "' fetch_template('navbar') . '";');
    
$pagenav construct_page_nav($totalrows"gallery.php?view=gal&amp;id=$id""&amp;pp=$limit");
    
mysql_free_result($fgalnav);
            if(
in_array($bbuserinfo['usergroupid'], array(4,5,6))) 
            { 
                eval(
'$submitgal .= "' fetch_template('gallery_subbutton') . '";');
            }
    eval(
'print_output("' fetch_template('gallery_gal') . '");'); 
can anyone help?
it show the lil page nav page with "Page of 0"
Reply With Quote
  #2  
Old 02-18-2004, 10:43 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm ... would be interesting to know which line is line 1611

Anyway, I don't see a division in that code so it must come from a function being called.
Reply With Quote
  #3  
Old 02-18-2004, 11:18 PM
VBDev's Avatar
VBDev VBDev is offline
 
Join Date: Jan 2004
Location: France
Posts: 2,570
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try adding $perpage=10; before the call to construct_page_nav()
Reply With Quote
  #4  
Old 02-19-2004, 12:26 AM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok got it working but its not display all the pages possbily, there is 4 pages possible but it only shows "Page of 4" "1" "2" ">" "last>>"
each "blahblah" represents another box
Reply With Quote
  #5  
Old 08-22-2005, 12:30 AM
Space Goat Space Goat is offline
 
Join Date: Nov 2004
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You also need to define $pagenumber before you call construct_page_nav(). Set it to the current page number the user gave to you in their GET request.

I had the same issue, and this solved it.
Reply With Quote
  #6  
Old 08-22-2005, 01:07 AM
Guest190829
Guest
 
Posts: n/a
Default

This thread is almost a year old, I think An-net solved the issue.
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 02:54 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.04053 seconds
  • Memory Usage 2,241KB
  • 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_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (5)postbit_onlinestatus
  • (6)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete