vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How to use construct_page_nav? (https://vborg.vbsupport.ru/showthread.php?t=98338)

derekivey 10-13-2005 08:19 PM

How to use construct_page_nav?
 
Hi,

I am making a Toplist hack for vBulletin 3.5, and need to know how to use construct_page_nav on it. Does anyone know if there are any tutorials around that show how?

Thanks,
Derek

Andreas 10-13-2005 08:21 PM

PHP Code:

// #############################################################################
/**
* Returns the HTML for multi-page navigation - based on code from 3dfrontier.com
*
* @param    integer    Current page number
* @param    integer    Number of items per page
* @param    integer    Total number of items found
* @param    string    Base address for links eg: showthread.php?t=99{&page=4}
* @param    string    Ending portion of address for links
*
* @return    string    Page navigation HTML
*/
function construct_page_nav($pagenumber$perpage$results$address$address2 ''

Does that answer your question?

Floris 10-13-2005 09:01 PM

Uhm ..

Curious myself here, tnx for the info k, but how do I then now use this on my source code? Am I thinking too hard here?

Andreas 10-13-2005 09:06 PM

Hmm .. what exactly do you want to know Floris?
You got your current pagenumber ($page = $vbulletin->input ...). you got the number of items you want to show per page (be it a hardcoded setting, from user input, or a system setting), you somehow also gut the total amout of items you want to display.
Pass all that to construct_page_nav() together with the script URL and you're done.

derekivey 10-13-2005 09:09 PM

No. Already looked at that... Still confused on how I would do this...

Would $results be my SQL query?

Floris 10-13-2005 09:12 PM

Quote:

Originally Posted by derekivey
No. Already looked at that... Still confused on how I would do this...

Would $results be my SQL query?

Existing scripts will show you how they do it :)

tnx k

derekivey 10-13-2005 09:36 PM

Ok, I tried it and I get this error:

Code:

Warning: Division by zero in /includes/functions.php on line 1809
Here is the code I added:

PHP Code:

$pagenav construct_page_nav($page$pp$sqlr'toplist.php?' $vbulletin->session->vars['sessionurl'], ""); 

Any ideas?


Thanks.

Andreas 10-13-2005 09:58 PM

What are the values of $page, $pp, $sqlr?

derekivey 10-13-2005 10:08 PM

$page = 1,
$pp = $vbulletin->options['toplist_sites_per_page'],
$sqlr = $db->query_read($sql);

Andreas 10-13-2005 10:16 PM

Does the comment say you should pass a mySQL result resource as 3rd parameter or does it say that you should pass the total number of results as third parameter?


All times are GMT. The time now is 10: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.01014 seconds
  • Memory Usage 1,737KB
  • 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_code_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_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