HMBeaty
03-05-2007, 10:12 PM
A nice mod that adds a newest games catgory to your v3 Arcade AND add a dropdown to your navbar for quick and easy access....
This has been tested and working on my website so I KNOW this works for 3.6.5. Not sure about any of the earlier versions
Only categories I've added to this are:
All Games
Random Games
Newest Games
Favorites
You can add more if you like. Just edit the the navbar template
This has been tested and working on my website so I KNOW this works for 3.6.5. Not sure about any of the earlier versions
################################################## #######################################
To add the Newest Category, follow these instructions
1. In the admincp create a new category called Newest or whatever you want to name it and make a note of the category ID number.
2. Open arcade.php
Find:
} else {
// Get games only from the specified category id.ABOVE it, add (replace xx with your category ID number):
} else if ($vbulletin->GPC['categoryid']==xx)
{
// List latest games...
// First of all, get a total game count.
$gamecountquery = $db->query_read("SELECT arcade_games.gameid FROM " . TABLE_PREFIX . "arcade_games AS arcade_games
" . iif($bitfieldcheck, "WHERE $bitfieldcheck"));
$gamecount = $db->num_rows($gamecountquery);
$perpage = $vbulletin->input->clean_gpc('r', 'perpage', TYPE_UINT);
$pagenumber = $vbulletin->input->clean_gpc('r', 'pagenumber', TYPE_UINT);
// set defaults
sanitize_pageresults($gamecount, $pagenumber, $perpage, 100, $vbulletin->options['gamesperpage']);
$start = (int)($perpage*$pagenumber)-$perpage;
$pagenav = construct_page_nav($pagenumber, $perpage, $gamecount, 'arcade.php?' . $vbulletin->session->vars['sessionurl'], ""
. (!empty($vbulletin->GPC['categoryid']) ? "&categoryid=" . $vbulletin->GPC['categoryid'] : "")
. (!empty($vbulletin->GPC['perpage']) ? "&pp=$perpage" : "")
);
$games = $db->query_read("SELECT arcade_games.*, user.username, arcade_categories.catname FROM " . TABLE_PREFIX . "arcade_games AS arcade_games
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (arcade_games.highscorerid=user.userid)
LEFT JOIN " . TABLE_PREFIX . "arcade_categories AS arcade_categories ON (arcade_games.categoryid=arcade_categories.categor yid)
" . iif($bitfieldcheck, " AND $bitfieldcheck") . "
ORDER BY gameid DESC
LIMIT $start, " . $vbulletin->options['gamesperpage']);################################################ #########################################
To add the dropdown menu, follow these instructions
1. In your admincp > styles & templates > style manager > "navbar" template
Find:
<!-- v3 Arcade -->
<td class="vbmenu_control"><a href="arcade.php$session[sessionurl_q]">Arcade</a></td>
<!-- /v3 Arcade -->Replace with:
<!-- v3 Arcade -->
<td id="arcadeoptions" class="vbmenu_control"><a href="arcade.php$session[sessionurl_q]">Arcade</a>
<script type="text/javascript"> vbmenu_register("arcadeoptions"); </script></td>
<!-- /v3 Arcade -->Then find:
<!-- / PAGENAV POPUP -->
</if>Add underneath (Replace xx with your category ID number for Newest Games):
<if condition="$show['popups']">
<div class="vbmenu_popup" id="arcadeoptions_menu" style="display:none">
<table cellpadding="4" cellspacing="1" border="0">
<tr><td class="thead" align="$stylevar[left]"><a href="arcade.php$session[sessionurl_q]">Arcade</a></td></tr>
<tr><td class="vbmenu_option" align="$stylevar[left]"><a href="arcade.php?$session[sessionurl]categoryid=-1">All Games</a></td></tr>
<tr><td class="vbmenu_option" align="$stylevar[left]"><a href="arcade.php?$session[sessionurl]categoryid=0">Random Games</a></td></tr>
<tr><td class="vbmenu_option" align="$stylevar[left]"><a href="arcade.php?$session[sessionurl]categoryid=xx">Newest Games</a></td></tr>
<tr><td class="vbmenu_option" align="$stylevar[left]"><a href="arcade.php?$session[sessionurl]categoryid=2">Favorites</a></td></tr>
</table>
</div>
</if>And you're done!!
This has been tested and working on my website so I KNOW this works for 3.6.5. Not sure about any of the earlier versions
Only categories I've added to this are:
All Games
Random Games
Newest Games
Favorites
You can add more if you like. Just edit the the navbar template
This has been tested and working on my website so I KNOW this works for 3.6.5. Not sure about any of the earlier versions
################################################## #######################################
To add the Newest Category, follow these instructions
1. In the admincp create a new category called Newest or whatever you want to name it and make a note of the category ID number.
2. Open arcade.php
Find:
} else {
// Get games only from the specified category id.ABOVE it, add (replace xx with your category ID number):
} else if ($vbulletin->GPC['categoryid']==xx)
{
// List latest games...
// First of all, get a total game count.
$gamecountquery = $db->query_read("SELECT arcade_games.gameid FROM " . TABLE_PREFIX . "arcade_games AS arcade_games
" . iif($bitfieldcheck, "WHERE $bitfieldcheck"));
$gamecount = $db->num_rows($gamecountquery);
$perpage = $vbulletin->input->clean_gpc('r', 'perpage', TYPE_UINT);
$pagenumber = $vbulletin->input->clean_gpc('r', 'pagenumber', TYPE_UINT);
// set defaults
sanitize_pageresults($gamecount, $pagenumber, $perpage, 100, $vbulletin->options['gamesperpage']);
$start = (int)($perpage*$pagenumber)-$perpage;
$pagenav = construct_page_nav($pagenumber, $perpage, $gamecount, 'arcade.php?' . $vbulletin->session->vars['sessionurl'], ""
. (!empty($vbulletin->GPC['categoryid']) ? "&categoryid=" . $vbulletin->GPC['categoryid'] : "")
. (!empty($vbulletin->GPC['perpage']) ? "&pp=$perpage" : "")
);
$games = $db->query_read("SELECT arcade_games.*, user.username, arcade_categories.catname FROM " . TABLE_PREFIX . "arcade_games AS arcade_games
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (arcade_games.highscorerid=user.userid)
LEFT JOIN " . TABLE_PREFIX . "arcade_categories AS arcade_categories ON (arcade_games.categoryid=arcade_categories.categor yid)
" . iif($bitfieldcheck, " AND $bitfieldcheck") . "
ORDER BY gameid DESC
LIMIT $start, " . $vbulletin->options['gamesperpage']);################################################ #########################################
To add the dropdown menu, follow these instructions
1. In your admincp > styles & templates > style manager > "navbar" template
Find:
<!-- v3 Arcade -->
<td class="vbmenu_control"><a href="arcade.php$session[sessionurl_q]">Arcade</a></td>
<!-- /v3 Arcade -->Replace with:
<!-- v3 Arcade -->
<td id="arcadeoptions" class="vbmenu_control"><a href="arcade.php$session[sessionurl_q]">Arcade</a>
<script type="text/javascript"> vbmenu_register("arcadeoptions"); </script></td>
<!-- /v3 Arcade -->Then find:
<!-- / PAGENAV POPUP -->
</if>Add underneath (Replace xx with your category ID number for Newest Games):
<if condition="$show['popups']">
<div class="vbmenu_popup" id="arcadeoptions_menu" style="display:none">
<table cellpadding="4" cellspacing="1" border="0">
<tr><td class="thead" align="$stylevar[left]"><a href="arcade.php$session[sessionurl_q]">Arcade</a></td></tr>
<tr><td class="vbmenu_option" align="$stylevar[left]"><a href="arcade.php?$session[sessionurl]categoryid=-1">All Games</a></td></tr>
<tr><td class="vbmenu_option" align="$stylevar[left]"><a href="arcade.php?$session[sessionurl]categoryid=0">Random Games</a></td></tr>
<tr><td class="vbmenu_option" align="$stylevar[left]"><a href="arcade.php?$session[sessionurl]categoryid=xx">Newest Games</a></td></tr>
<tr><td class="vbmenu_option" align="$stylevar[left]"><a href="arcade.php?$session[sessionurl]categoryid=2">Favorites</a></td></tr>
</table>
</div>
</if>And you're done!!