Thursday, 1 November 2007

Random Games in Home Categories

This was posted by Netpants on Arcade Webmasters.

I've tested it and it works well. I might add it to my main site but still wondering if its worth the extra queries.

To make the games random on the front page of your GSS in the Home categories simply do the following.

Open /plugins/site/themes/21/homecatbox.php and find this

Code:

$games = get_games("order=deforder&sort=defsort&shortdesc=".$themecfg['maxdesclength']."&limitstart=0&limitnum=".$themecfg['newestgameboxnumber']."&thecat="._sp($category['name'])."&htmlize=true");

And replace with this

Code:


$q = "SELECT * FROM games WHERE cat='"._sp($category['name'])."' AND id!='".$game['id']."' ORDER BY RAND() DESC LIMIT 0, ".$themecfg['newestgameboxnumber']."";
$games = get_games("shortdesc=".$themecfg['maxdesclength']."&limitstart=0&limitnum="."&htmlize=true&diffquery=".$q);

Hit save, and your done. Then refresh the home page a few times, and a random set of games should appear each time.

3 comments:

Anonymous said...

You are god-like. Thank you!

Keith said...

It's a great Mod but it doesn't work with the caching system in GSS...

I have my Awesome theme set up to do that and it only works if Caching is turned off... :(


Thanks for the article... :)

Anonymous said...

Thanks for the mod, works great on my site.

arcadevoyage.com