Game Section Community Forums

Full Version: one last thing, anyone know how to put "last champions" on forum index page?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I'm trying to put the "Last champions and scores" onto my forum index page, but I'm not sure how. I found the {$stats} call and tried using it on the index page, but I just got an error. I'm sure it's because it's looking in the wrong place. If anyone knows how to do this, I'd appreciate the help.
Only on the index page, or on each page of your board?
I'd like for just the last champions to appear on the index page only.

I'm sure I can find where to put the code, I'm just not sure what the right code is to call the Last Champs from the index.
This makes the stats var available Wink

PHP Code:
require_once MYBB_ROOT."inc/functions_games.php";
$stats stats(); 
Ok, I'm not as smart as I thought I was hehe. I'm supposed to declare that in global.php, right?
Well, when you only want it on your index.php, it's better to declare it in index.php. When you do it in global.php, it will be runed in each file, but only used in index.php Wink
I'd quite like the games stats shown on the top of my forum index. Tried adding what you suggested into index.php but if I include the $stats = stats(); line it breaks the forum (blank screen). If I remove this line then the forum works. Looks like $stats is used to display forum statistics?

index.php line 191
// First, load the stats cache.
$stats = $cache->read("stats");

any ideas how to get this to work?

Thanks
OK.

Open index.php and find:
PHP Code:
require_once "./global.php";

require_once 
MYBB_ROOT."inc/functions_post.php";
require_once 
MYBB_ROOT."inc/functions_forumlist.php";
require_once 
MYBB_ROOT."inc/class_parser.php";
$parser = new postParser

After add:
PHP Code:
//Requires
require_once MYBB_ROOT."inc/functions_games.php";
require_once 
MYBB_ROOT."inc/class_games.php";

$games_core = new games;

//Settings of the game section
$query $db->query("SELECT * FROM ".TABLE_PREFIX."games_settings WHERE sid='1'");
$settings_games $db->fetch_array($query);
$settings_games_test $db->num_rows($query);

//Settings doesnt exist
if($settings_games_test == 0)
{
    die(
"The Game Section Settings doesn't exist.");
}

//Settings
if($mybb->user['uid'] != 0)
{
    if(
$mybb->user['maxgames'] == "0")
    {
        
$maxgames $settings_games['maxgames'];
    }
    else
    {
        
$maxgames $mybb->user['maxgames'];
    }
    
    if(
$mybb->user['maxscores'] == "0")
    {
        
$maxscores $settings_games['maxscores'];
    }
    else
    {
        
$maxscores $mybb->user['maxscores'];
    }

    if(
$mybb->user['sortat'] == "0")
    {
        
$sortat $settings_games['sortat'];
    }
    else
    {
        
$sortat $mybb->user['sortat'];
    }
    
    if(
$mybb->user['sorting'] == "0")
    {
        
$sorting $settings_games['sorting'];
    }
    else
    {
        
$sorting $mybb->user['sorting'];
    }
    
    if(
$mybb->user['games_theme'] == "0")
    {
        
$theme_games_tid $settings_games['theme'];
    }
    else
    {
        
$theme_games_tid $mybb->user['games_theme'];
    }
}
else
{
    
$maxgames $settings_games['maxgames'];
    
$maxscores $settings_games['maxscores'];
    
$sortat $settings_games['sortat'];
    
$sorting $settings_games['sorting'];
    
$theme_games_tid $settings_games['theme'];
}

//Game Section Theme
$query $db->query("SELECT * FROM ".TABLE_PREFIX."games_themes WHERE tid='".$theme_games_tid."'");
$theme_games $db->fetch_array($query);
$theme_games_test $db->num_rows($query);

if(
$theme_games_test == 0)
{
    
$query $db->query("SELECT * FROM ".TABLE_PREFIX."games_themes WHERE tid='".$settings_games['theme']."'");
    
$theme_games $db->fetch_array($query);
    
$theme_games_test2 $db->num_rows($query);
}
else
{
    
$theme_games_test2 1;
}

//No theme available
if($theme_games_test2 == 0)
{
    die(
"The standard and the user selected Game Section theme doesn't exist.");
}

//Templates
$templatelist "games_stats, games_stats_champs_bit, games_stats_games_bit";

$games_core->template_cache($db->escape_string($templatelist));

//Stats
$stats_games stats(); 

And then add $stats_games in your templates.
Thanks Paretje.
I only want to display the latest score on my index page (i.e. I just want to use {$lang->last_score_sen})

Will I have to add all that code to the index.php page to use that?
Pages: 1 2