 [ ← blog / club ](/) May 14, 2011  ·  \#club  ·  2 min read 

# Game Ladder Script



 Two years ago I decided to check out an old gaming group that I used to play with years before that. I created a plugin to seamlessly add a ladder system into their web site.  A ladder system is typically used to match one-on-one matches. This allowed the group to add friendly competition without major overhaul of their web site.  I only made one version, but I plan on developing it a little bit further. The script allows for multiple games,which are dynamically set, and requires only one additional SQL table. You can download [the script for personal and non-commercial use.](http://glamanate.com/wp-content/uploads/2011/05/Ladder-v1.0.zip)

## Glamanate Game Ladder Script Documentation

**gls\_display($string, \[$orderby\])**

> This function will return an array of members with points, off of the table declared in the script's file. The *$string* value represents the game value, such as "wow" for World of Warcraft, or "sc2" for StarCraft 2. By default it orders based on points, but other values include: win, loss. Since it returns a raw array, you must use a *foreach* statement to extract the information. The .zip file contains sample scripts.

**gls\_username($array)**

> This function is used to return the username of a player record within the *gls\_display* array.

**gls\_points($array)**

> This function is used to return the points of a player record within the *gls\_display* array.

**gls\_wins($array)**

> This function is used to return the wins of a player record within the *gls\_display* array.

**gls\_loss($array)**

> This function is used to return the losses of a player record within the *gls\_display* array.

**gls\_report($win, $loss, $game)**

> This function is used to record a lost match. This function would be located on the loss report form's action page. The *$win* parameter is the winner's user database ID,  *$loss* is the loser's user database ID, and again the *$game* parameter is based on what you choose to differentiate between games, or for the main game used.

 

  ![](/themes/custom/mglaman/images/headshot.webp)Thanks for reading

I write about Drupal, PHP, and the quiet infrastructure behind large sites — caching, config, and testing. New posts land every week or two.

 [Subscribe via RSS →](/rss.xml) [About me →](/about-me) 

 



 

  [← Older

Caledonia Sno Lords

 ](/blog/caledonia-sno-lords) [Newer →

SR Photography

 ](/blog/sr-photography)