View Full Version : How to use construct_page_nav?
derekivey
10-13-2005, 08:19 PM
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
// ################################################## ###########################
/**
* 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
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:
Warning: Division by zero in /includes/functions.php on line 1809
Here is the code I added:
$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?
akanevsky
10-13-2005, 11:04 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?
lol :) No, it tells me that I should pass the number of cooked potatos that I have in my refrigerator.
Andreas
10-13-2005, 11:08 PM
You must have another comment than me ;)
derekivey
10-14-2005, 12:26 AM
Ok, I got it working, but do I need to add LIMIT to the query? Because when I click a page it does nothing.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.