vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Addon: Auto-populate Navbar menu (for John's Arcade V3) (https://vborg.vbsupport.ru/showthread.php?t=61278)

Natch 02-06-2004 10:00 PM

Addon: Auto-populate Navbar menu (for John's Arcade V3)
 
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

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

John 02-07-2004 02:13 PM

Very nice, good work Natch!

msimplay 02-07-2004 02:59 PM

what querie ?

Natch 02-07-2004 03:20 PM

Quote:

Originally Posted by msimplay
what querie ?

It performs one query to the games table to get game title (for the link wording), game id (for the link itself), and game settings (to check the game is enabled from the Arcade CP) ...

Blackbeard 02-07-2004 03:25 PM

Great work m8

but when i click on arcade at top of list and it takes me to arcade page i see this above and below the nav bar

// remove this line and the endif if you wish all users and guests to view the menu

what have i done wrong??

Natch 02-07-2004 03:55 PM

Okies - I get the bug :)

I'll fix this up now and get back to u ...

Natch 02-07-2004 04:03 PM

UPDATED: above - check the new additions / modifications or simply remove the erroneous commenting as mentioned in post #5

13th_Disciple 02-07-2004 04:33 PM

thank you Natch.. will add right now.. good work.. also gonna use the flash player navbar auto-populate..

Blackbeard 02-07-2004 04:35 PM

Thanks, works great thanks for quick reply

M1th 02-07-2004 04:36 PM

not a bad idea, but it creates a HUGE dropdown menu. Imagine having 100 games for the arcade... *grins* :D


All times are GMT. The time now is 01:53 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01466 seconds
  • Memory Usage 1,758KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete