Increase number of players in list?

General Chat, Comments
Post Reply
User avatar
cbsarge
Posts: 195
Joined: Mon Sep 14, 2015 3:20 pm

Increase number of players in list?

Post by cbsarge »

When I click on Search Players the number of results is limited to 20. How can I increase this number or maybe make it paginated?

Thank you.
User avatar
cbsarge
Posts: 195
Joined: Mon Sep 14, 2015 3:20 pm

Re: Increase number of players in list?

Post by cbsarge »

Would adding something like this to the content.php file in the view_player module work? I'm sure this isn't exactly right as it cause my page to crash but, perhaps it's close?

Code: Select all

<a href='.$_SERVER['PHP_SELF'].'?result='.($result+10).'>Next</a>
User avatar
gmoore
Posts: 212
Joined: Wed Jun 04, 2014 5:40 pm

Re: Increase number of players in list?

Post by gmoore »

The quantity is in the select statement:

Like: limit 0,20

This limits the result set that you get from the select.

Greg
Running a game is like riding a bike ... well it should be!

New Worlds Engine / FunMayhem.com
Helping you get your game concept up and running. Now.
User avatar
cbsarge
Posts: 195
Joined: Mon Sep 14, 2015 3:20 pm

Re: Increase number of players in list?

Post by cbsarge »

How might I add a link to see the next or previous 20?
User avatar
gmoore
Posts: 212
Joined: Wed Jun 04, 2014 5:40 pm

Re: Increase number of players in list?

Post by gmoore »

This would be the same concept as pagination for a blog page. You might include the starting player and ending players in the URL (like: ?start_player=123&end_player=456). You would then add a section the content.php to recognize your are going backward or forward (if (isset($_GET["back"]) ... if (isset($_GET["forward"]))). Then change the SQL to make the range less than or greater than the start_player or end_player but still limit the last or first 20 accordingly.

I know this is pseudo code but if you look at any code that does pagination you can get the idea.

Greg
Running a game is like riding a bike ... well it should be!

New Worlds Engine / FunMayhem.com
Helping you get your game concept up and running. Now.
User avatar
KyleMassacre
Posts: 573
Joined: Wed Nov 27, 2013 12:42 pm

Re: Increase number of players in list?

Post by KyleMassacre »

This is where the limit keyword in queries comes into play:

Code: Select all

$perPage = (isset($_GET['perPage']) ? $_GET['perPage'] + 0 : 20);
$page = (isset($_GET['page'])  ? $_GET['page'] + 1 : 0);
$start = $page * $perPage;
$result = $db->Execute("select * from users limit ?,?",$start,$perPage);
//echo all the data here
ButtonArea();
if($page >= 1)
    echo LinkButton("Back","index.php?p=module&page=".$page-1);
echo LinkButton("Next","index.php?p=module&page=".$page+1);
Something like that. The numbers may be wrong and you would also do some checks and count how many players you have
User avatar
cbsarge
Posts: 195
Joined: Mon Sep 14, 2015 3:20 pm

Re: Increase number of players in list?

Post by cbsarge »

What about the number of entries in the drop downs on some of the screens? Is it possible to increase that number?
User avatar
KyleMassacre
Posts: 573
Joined: Wed Nov 27, 2013 12:42 pm

Re: Increase number of players in list?

Post by KyleMassacre »

I believe that is set to a fixed height hiding the overflow so you may have to change the CSS properties on that
User avatar
cbsarge
Posts: 195
Joined: Mon Sep 14, 2015 3:20 pm

Re: Increase number of players in list?

Post by cbsarge »

Would that be in the CSS for the template I'm using or is it buried in all of the module folders in different CSS files?

Thanks!
User avatar
cbsarge
Posts: 195
Joined: Mon Sep 14, 2015 3:20 pm

Re: Increase number of players in list?

Post by cbsarge »

Hmmm... there seems to be a size parameter applied to the slection list. Increasing that on the fly lengthens the drop down but, not the number of results returned.
Post Reply

Return to “General”