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

Reply
 
Thread Tools Display Modes
  #71  
Old 01-11-2005, 02:14 PM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hack has been released here

Thanks for all the help rendered everyone
Reply With Quote
  #72  
Old 01-15-2005, 07:55 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sabret00the
wow, it is, i haven't ever rewritten the code i was giving along time ago for sorting pagenav but the code i have is 30 lines long :shock:

please share the knowledge
did the 3 line version of this never surface in this thread?
Reply With Quote
  #73  
Old 01-16-2005, 12:44 PM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Unfortunately nope.
I would be interested to know too.
Reply With Quote
  #74  
Old 01-16-2005, 01:49 PM
rake's Avatar
rake rake is offline
 
Join Date: Nov 2002
Posts: 311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cinq
Unfortunately nope.
I would be interested to know too.
This is the proper way to do pagination. It's from one of my scripts, and the original code is taken right out of vbulletin. All you need to edit are the two queries, the template that is called, and the fields you want to sort by.

PHP Code:
    // globalize variables
    
globalize($_REQUEST, array(
        
'pagenumber' => INT// pagenumber
        
'perpage' => INT// results per page
        
'sortfield' => STR// field by which to sort results
        
'sortorder' => STR// order in which to sort
    
));

    if (
$sortfield == '') {
        
$sortfield 'name';
    }

    if (
$sortorder == '') {
        
$sortorder 'asc';
    }



    switch (
$sortfield)
    {
        case 
'name':
            
$sqlsort 'name';
            break;
        case 
'id':
            
$sqlsort 'id';
            break;
        default:
            
$sqlsort 'name';
            
$sortfield 'name';
    }


    if (
$sortorder != 'asc')
    {
        
$sortorder 'desc';
        
$oppositesort 'asc';
    }
    else
    {
        
// $sortorder = 'ASC';
        
$oppositesort 'desc';
    }


    
$sorturl "$_SERVER[PHP_SELF]?$session[sessionurl]";


    eval(
'$sortarrow[' $sortfield '] = "' fetch_template('forumdisplay_sortarrow') . '";');



    
$dscount $DB_site->query_first("
        SELECT COUNT(*) AS count FROM site_garment
    "
);
    
$dscount $dscount['count'];

    
// set defaults
    
sanitize_pageresults($dscount$pagenumber$perpage10020);

    
$limitlower = ($pagenumber 1) * $perpage+1;
    
$limitupper = ($pagenumber) * $perpage;
    
$counter 0;

    if (
$limitupper $dscount)
    {
        
$limitupper $dscount;
        if (
$limitlower $dscount)
        {
            
$limitlower $dscount-$perpage;
        }
    }
    if (
$limitlower <= 0)
    {
        
$limitlower 1;
    }


    
$spheres $DB_site->query("SELECT * FROM site_garment ORDER BY $sqlsort $sortorder LIMIT ". ($limitlower-1) . ", $perpage");

    
$counter 0;
    
$resultbits '';
    while (
$grid $DB_site->fetch_array($spheres) AND $counter++ < $perpage)
    {

        
$grid[bonuses] = nl2br($grid[bonuses]);
        eval(
'$dresspheres .= "' fetch_template('site_ffx2_dsp_grid') . '";');



    }  
// end while
    
$pagenav construct_page_nav($dscount"$_SERVER[PHP_SELF]?$session[sessionurl]""&amp;pp=$perpage&order=$sortorder&amp;sort=$sortfield"); 
Reply With Quote
  #75  
Old 01-17-2005, 11:52 AM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks again Alex, appreciate it
I will try your code when time permits.
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:35 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.03624 seconds
  • Memory Usage 2,258KB
  • Queries Executed 14 (?)
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
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete