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)

Intex 07-22-2004 01:14 PM

Nice one Natch. Any way to include the little mini-thumbnails for each game?

/me clicks install.

Natch 07-22-2004 11:09 PM

Yeah - I should think that would be a trivial change...

Let me look into it - it would of course make the menu more massive again...

Natch 07-23-2004 01:22 AM

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 :D

Intex 07-23-2004 04:30 AM

Adding the images to the menu works perfect for me Natch. Good job, thx. Natch.

Natch 07-23-2004 06:14 AM

NP :) good idea :D

Tombstone 10-25-2004 11:55 AM

As soon as I edit the functions.php file I loose access to the site (i.e. blank page). I'm doing just a simple cut and paste using notepad.

Tombstone 10-25-2004 12:13 PM

Any ideas?

Natch 10-25-2004 12:54 PM

Sounds like you are either copying and pasting too much code, or not enough.

Nothing in this code would cause you to get that kind of error, unless you are fundamentally altering the name of the final template name...

Revert to your backup'ed file, then make the alterations more carefully..., or send me your original file and your altered file and I'll work it out for you.

Tombstone 10-25-2004 02:10 PM

How can I send it to you? Post it?

jugo 05-25-2005 08:13 PM

OK...so I wanted to display 10 Random Arcades on MY list so this is what I did...

Apply the changes for the Most Played Games and change the query to this:

PHP Code:

    $theseGames $DB_site->query("SELECT gameid,title,gamesettings FROM " TABLE_PREFIX "games ORDER BY RAND() LIMIT $limit"); 



All times are GMT. The time now is 10:50 AM.

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.01209 seconds
  • Memory Usage 1,782KB
  • 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
  • (7)bbcode_php_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