Back to vBulletin 3.0 Add-Ons

Addon: Auto-populate Navbar menu (for John's Arcade V3)
Mod Version: 1.00, by Natch

This modification is in the archives.
vB Version: 3.0.3 Rating: (0 vote - 0 average) Installs: 15
Released: 07 Feb 2004 Last Update: 07 Feb 2004 Downloads: 5
Not Supported  

Addon: Auto-populate Navbar menu (for John's Arcade V3)

What this hack does:

It replaces the link in your navbar for the Arcade with a Dropdown menu of all the games that are active in your Arcade.

Motivation: Extrapolated from my other auto-populating menu for Erwin's vB3 hack ...

Files to edit: 2
global.php
includes/functions.php
Template to edit: 1
navbar
New phrases to insert: 1
Queries added: 1

Step 1: Add the following in the Phrase Manager under GLOBAL

Alternate: you can import the single phrase using the included XML file

********************************************************
Name: arcade_addon_title
Phrase: The Arcade!
********************************************************

Step 2: Add the following at the bottom of global.php

Find:
Code:
/*======================================================================*\
|| ####################################################################
|| # Downloaded:
Add Before:
PHP Code:
// Addon to John's vB3 ArcadeV3 hack - created by Natch
    
$nav_arcade genArcadeMenu();
// Addon to John's vB3 ArcadeV3 hack - created by Natch 
Step 3: Add the following at the bottom of includes/functions.php

Find:
Code:
/*======================================================================*\
|| ####################################################################
|| # Downloaded:
Add Before:
PHP Code:
// Addon to John's vB3 ArcadeV3 hack - created by Natch
function genArcadeMenu() {
    global 
$DB_site,$vboptions;
    
$theseGames $DB_site->query("SELECT gameid,title,gamesettings FROM " TABLE_PREFIX "games ORDER BY title");
    while (
$thisGame $DB_site->fetch_array($theseGames)) {
        
$arcmenu.= (is_int($thisGame[gamesettings]/2)) ? "" "\t\t<tr><td class=\"vbmenu_option\"><a href=\"$vboptions[bburl]/arcade.php?$session[sessionurl]do=play&amp;gameid=".$thisGame[gameid]."\">".$thisGame[title]."</a></td></tr>\n";
    }
    return 
$arcmenu;
}
// Addon to John's vB3 ArcadeV3 hack - created by Natch 
Step 4: Add the following to the template 'navbar'

Find:
Code:
<!-- / NAVBAR POPUP MENUS -->
Add Before:
Code:
<!-- Addon to John's vB3 ArcadeV3 hack - created by Natch -->
	<if condition="$show['member']"> <!-- remove this line and the endif if you wish all users and guests to view the menu -->
	<!-- flash arcade auto-menu -->
	<div class="vbmenu_popup" id="flasharcade_menu" style="display:none">
		<table cellpadding="4" cellspacing="1" border="0">
		<tr><td class="thead"><a href="$vboptions[bburl]/arcade.php?$session[sessionurl]" title="$vbphrase[arcade_addon_title]">$vbphrase[arcade_addon_title]</a></td></tr>
$nav_arcade
		</table>
	</div>
	<!-- / flash arcade auto-menu -->
	</if>
<!-- Addon to John's vB3 ArcadeV3 hack - created by Natch -->
Find:
Code:
<td class="vbmenu_control"><a href="arcade.php?$session[sessionurl]">Arcade</a></td>
REPLACE WITH:
Code:
<!-- Addon to John's vB3 ArcadeV3 hack - created by Natch -->
			<if condition="$show['member']"> <!-- remove this line and the endif if you wish all users and guests to view the menu -->
				<td id="flasharcade" class="vbmenu_control"><a href="#flasharcade">$vbphrase[arcade_addon_title]</a> <script type="text/javascript"> vbmenu_register("flasharcade"); </script></td>
			</if>
<!-- Addon to John's vB3 ArcadeV3 hack - created by Natch -->
NOTE: in the two navbar edits there are conditionals that WILL CAUSE the menu to only appear to Registered users - remove these conditional wrappers to show the menu to all and sundry ...

Should work Enjoy, and props to John for his great Hack ...
U can see a demo @ http://www.mobileforces.org/ << running vBulletin 3.0.0 RC4 and vBIndex RC3, on PHP v4.3.4, MySQL 4.0.15

Screenshots attached: one with all default games enabled, and one with asteroids disabled

UPDATE: fixed up my comments - damn that copy and paste ... those that downloaded the attachment b4 5AM +11GMT, re-get the attachment, or make the following alterations to the above script:

Find twice:
Code:
// remove this line and the endif if you wish all users and  guests to view the menu
Replace with:
Code:
<!-- remove this line and the endif if you wish all users and guests to view the menu -->
UPDATE: IF YOU WANT ONLY N MOST POPULAR GAMES - check out this post

Spoiler (click to open)


Quote by Natch
Another option (if it is just the size of the list that is too big) is to edit the CSS statements for the navbar popup links - drop them down a fint size and it should help a lot ...

Sometimes I forget that not everyone has 1280x1024 ...

I'll look into this ok guys ?
OK - I've created the new function to populate the menu with only the N most played games - atm the value of N will be hardcoded by you the hacker into your global.php (where the function is called), but for the next release (which will have this variant as an option) I will add it to the Arcade ACP Options page (once I learn how to do ACP options LOL) - I will not be updating the original instructions until the next release ...

IF YOU WANT TO HAVE ONLY N MOST POPULAR OPTIONS

Find in includes/functions.php
PHP Code:
// Addon to John's vB3 ArcadeV3 hack - created by Natch
function genArcadeMenu() {
    global 
$DB_site,$vboptions;
    
$theseGames $DB_site->query("SELECT gameid,title,gamesettings FROM " TABLE_PREFIX "games ORDER BY title");
    while (
$thisGame $DB_site->fetch_array($theseGames)) {
        
$arcmenu.= (is_int($thisGame[gamesettings]/2)) ? "" "\t\t<tr><td class=\"vbmenu_option\"><a href=\"$vboptions[bburl]/arcade.php?$session[sessionurl]do=play&amp;gameid=".$thisGame[gameid]."\">".$thisGame[title]."</a></td></tr>\n";
    }
    return 
$arcmenu;
}
// Addon to John's vB3 ArcadeV3 hack - created by Natch 
Replace with:
PHP Code:
// Addon to John's vB3 ArcadeV3 hack - created by Natch
function genArcadeMenu($limit) {
    global 
$DB_site,$vboptions;
    
$theseGames $DB_site->query("
                    SELECT " 
TABLE_PREFIX "games.gameid AS gameid, " TABLE_PREFIX "games.title AS title, " TABLE_PREFIX "games.gamesettings as gamesettings, COUNT(" TABLE_PREFIX "gamesessions.gamename) AS popularity 
                    FROM " 
TABLE_PREFIX "games 
                    INNER JOIN " 
TABLE_PREFIX "gamesessions 
                    ON " 
TABLE_PREFIX "games.shortname = " TABLE_PREFIX "gamesessions.gamename 
                    GROUP BY title 
                    ORDER BY popularity DESC 
                    LIMIT 
$limit
                    "
);
    while (
$thisGame $DB_site->fetch_array($theseGames)) {
        
$arcmenu.= (is_int($thisGame[gamesettings]/2)) ? "" "\t\t<tr><td class=\"vbmenu_option\"><a href=\"$vboptions[bburl]/arcade.php?$session[sessionurl]do=play&amp;gameid=".$thisGame[gameid]."\">".$thisGame[title]."</a></td></tr>\n";
    }
    return 
$arcmenu;
}
// Addon to John's vB3 ArcadeV3 hack - created by Natch 
Find in global.php
PHP Code:
// Addon to John's vB3 ArcadeV3 hack - created by Natch
    
$nav_arcade genArcadeMenu();
// Addon to John's vB3 ArcadeV3 hack - created by Natch 
Replace with:
PHP Code:
// Addon to John's vB3 ArcadeV3 hack - created by Natch
    
$nav_arcade genArcadeMenu("6");
// Addon to John's vB3 ArcadeV3 hack - created by Natch 
This should do it ... change the value in the global function call (above) to match your required number of menu options ...

Close


UPDATE: if you wat IMGAES in your dropdown menu, check out this post

Spoiler (click to open)


OK - to add images to the menu:

Open includes/functions.php, find the query you are using (remember there are multiple versions of this query):
Original:
PHP Code:
// Addon to John's vB3 ArcadeV3 hack - created by Natch
function genArcadeMenu() {
    global 
$DB_site,$vboptions;
    
$theseGames $DB_site->query("SELECT gameid,title,gamesettings FROM " TABLE_PREFIX "games ORDER BY title");
    while (
$thisGame $DB_site->fetch_array($theseGames)) {
        
$arcmenu.= (is_int($thisGame[gamesettings]/2)) ? "" "\t\t<tr><td class=\"vbmenu_option\"><a href=\"$vboptions[bburl]/arcade.php?$session[sessionurl]do=play&amp;gameid=".$thisGame[gameid]."\">".$thisGame[title]."</a></td></tr>\n";
    }
    return 
$arcmenu;
}
// Addon to John's vB3 ArcadeV3 hack - created by Natch 
Replace with:
PHP Code:
// Addon to John's vB3 ArcadeV3 hack - created by Natch
function genArcadeMenu() {
    global 
$DB_site,$vboptions,$stylevar;
    
$theseGames $DB_site->query("SELECT gameid,title,gamesettings,miniimage FROM " TABLE_PREFIX "games ORDER BY title");
    while (
$thisGame $DB_site->fetch_array($theseGames)) {
        
$arcmenu.= (is_int($thisGame[gamesettings]/2)) ? "" "\t\t<tr><td class=\"vbmenu_option\"><img src=\"$vboptions[bburl]/$stylevar[imgdir_arcade]/".$thisGame[miniimage]."\" alt=\"\" style=\"border:0;padding-right:3px\" align=\"absmiddle\" /><a href=\"$vboptions[bburl]/arcade.php?$session[sessionurl]do=play&amp;gameid=".$thisGame[gameid]."\">".$thisGame[title]."</a></td></tr>\n";
    }
    return 
$arcmenu;
}
// Addon to John's vB3 ArcadeV3 hack - created by Natch 
Most often played:
PHP Code:
// Addon to John's vB3 ArcadeV3 hack - created by Natch
function genArcadeMenu($limit) {
    global 
$DB_site,$vboptions;
    
$theseGames $DB_site->query("
                    SELECT " 
TABLE_PREFIX "games.gameid AS gameid, " TABLE_PREFIX "games.title AS title, " TABLE_PREFIX "games.gamesettings as gamesettings, COUNT(" TABLE_PREFIX "gamesessions.gamename) AS popularity
                    FROM " 
TABLE_PREFIX "games
                    INNER JOIN " 
TABLE_PREFIX "gamesessions
                    ON " 
TABLE_PREFIX "games.shortname = " TABLE_PREFIX "gamesessions.gamename
                    GROUP BY title
                    ORDER BY popularity DESC
                    LIMIT 
$limit
                    "
);
    while (
$thisGame $DB_site->fetch_array($theseGames)) {
        
$arcmenu.= (is_int($thisGame[gamesettings]/2)) ? "" "\t\t<tr><td class=\"vbmenu_option\"><a href=\"$vboptions[bburl]/arcade.php?$session[sessionurl]do=play&amp;gameid=".$thisGame[gameid]."\">".$thisGame[title]."</a></td></tr>\n";
    }
    return 
$arcmenu;
}
// Addon to John's vB3 ArcadeV3 hack - created by Natch 
Replace with:
PHP Code:
function genArcadeMenu($limit) {
    global 
$DB_site,$vboptions,$stylevar;
    
$theseGames $DB_site->query("
                    SELECT games.gameid AS gameid, games.title AS title, games.gamesettings as gamesettings, games.miniimage AS miniimage, COUNT(gamesessions.gamename) AS popularity 
                    FROM " 
TABLE_PREFIX "games as games
                    INNER JOIN " 
TABLE_PREFIX "gamesessions AS gamesessions
                    ON games.shortname = gamesessions.gamename 
                    GROUP BY title 
                    ORDER BY popularity DESC 
                    LIMIT 
$limit
                    "
);
    while (
$thisGame $DB_site->fetch_array($theseGames)) {
        
$arcmenu.= (is_int($thisGame[gamesettings]/2)) ? "" "\t\t<tr><td class=\"vbmenu_option\"><img src=\"$vboptions[bburl]/$stylevar[imgdir_arcade]/".$thisGame[miniimage]."\" alt=\"\" style=\"border:0;padding-right:3px\" align=\"absmiddle\" /><a href=\"$vboptions[bburl]/arcade.php?$session[sessionurl]do=play&amp;gameid=".$thisGame[gameid]."\">".$thisGame[title]."</a></td></tr>\n";
    }
    return 
$arcmenu;

Open global.php, find:
PHP Code:
// Addon to Erwin's vB3 Flash hack - created by Natch
    
$nav_arcade genArcadeMenu("9"); 
MOVE THESE LINES DOWN TO BELOW:
PHP Code:
// #############################################################################
// get style variables
$stylevar fetch_stylevars($style$bbuserinfo); 
Hope this is useful to y'all

Close

Download

This modification is archived and cannot be downloaded.

Screenshots

   

Similar Mods

Add-On Releases v3 Arcade Dropdown Menu in your Navbar with Newest Games Category Modification Graveyard
[HTL] Addon: Auto-populate NavBar popup menu [for Erwin's Flash Player] vBulletin 3.0 Full Releases

vblts.ru supports vBulletin®, 2022-2024