Page 1 of 1

Arcade-Block geht nicht ...

Posted: 29. March 2008 16:06
by derkubi
Eigentlich sollten hiermit Arcade-Infos als Block im Portal angezeigt werden :

/portal/block/arcade.php

Code: Select all

    <?php
    /*
    *
    * @package phpBB3 Portal  a.k.a canverPortal  ( www.phpbb3portal.com )
    * @version $Id: links.php,v 1.4 2008/02/09 08:18:14 angelside Exp $
    * @copyright (c) Canver Software - www.canversoft.net
    * @license http://opensource.org/licenses/gpl-license.php GNU Public License 
    *
    */
    if (!defined('IN_PHPBB') or !defined('IN_PORTAL'))
    {
        die('Hacking attempt');
        exit;
    }



    if (file_exists($phpbb_root_path . 'includes/arcade/arcade_class.' . $phpEx))
    {
        include($phpbb_root_path . 'includes/arcade/arcade_class.' . $phpEx);        
        $arcade = new arcade(false);
        
        // Start of Top 3 Arcade Players
        $real_leaders_count = sizeof($arcade->leaders);
        $leaders_count = ($real_leaders_count > 3) ? 3 : $real_leaders_count;    

        $arcade_leaders_img = array();
        $arcade_leaders_img[0] = '';
        $arcade_leaders_img[1] = $phpbb_root_path . $arcade->config['image_path'] . '1st.gif';
        $arcade_leaders_img[2] = $phpbb_root_path . $arcade->config['image_path'] . '2nd.gif';
        $arcade_leaders_img[3] = $phpbb_root_path . $arcade->config['image_path'] . '3rd.gif';
        
        $arcade_leaders_img_alt = array();
        $arcade_leaders_img_alt[0] = '';
        $arcade_leaders_img_alt[1] = $user->lang['ARCADE_FIRST'];
        $arcade_leaders_img_alt[2] = $user->lang['ARCADE_SECOND'];
        $arcade_leaders_img_alt[3] = $user->lang['ARCADE_THIRD'];

        if ($leaders_count > 0)
        {
            $rank = 0;
            $actual_rank = 0;
            $previous_wins = 0;
            for ($i = 0; $i < $leaders_count; $i++)
            {
                //This code is used to calculate the actual rank.
                //For example if there are ties...
                $actual_rank++;
                if ($previous_wins != $arcade->leaders[$i]['total_wins'])
                {
                    $rank = $actual_rank;
                }
                $previous_wins = $arcade->leaders[$i]['total_wins'];

                $user_link = $arcade->format_username('full', $arcade->leaders[$i]['user_id'], $arcade->leaders[$i]['username'], $arcade->leaders[$i]['user_colour']);
                
                $template->assign_block_vars('arcade_leaders', array(
                    'ARCADE_LEADERS_RANK'        => $rank,
                    'ARCADE_LEADERS'             => $user_link,
                    'ARCADE_LEADERS_IMAGE'        => (isset($arcade_leaders_img[$rank])) ? $arcade_leaders_img[$rank] : '',
                    'ARCADE_LEADERS_IMAGE_ALT'    => (isset($arcade_leaders_img_alt[$rank])) ? $arcade_leaders_img_alt[$rank] : '',
                    'VICTORIES'                    => $arcade->leaders[$i]['total_wins']
                ));
            }
        }
        // End of Top 3 Arcade Players
        
        //Newest Game
        if (sizeof($arcade->newest_games))
        {
            $template->assign_vars(array(
                'S_HAS_NEWEST_GAME'        => true,
                'U_NEWEST_GAME_PLAY'    => append_sid("{$phpbb_root_path}arcade.$phpEx", 'mode=play&g=' . $arcade->newest_games[0]['game_id']),
                'NEWEST_GAME_IMAGE'        => ($arcade->newest_games[0]['game_image'] != '') ? $phpbb_root_path . "arcade.$phpEx?img=" . $arcade->newest_games[0]['game_image'] : '',
                'NEWEST_GAME_NAME'        => $arcade->newest_games[0]['game_name'],
            ));
        }
        //Newest Game
        
        //Total Games, Time and Plays
        $total_games = sizeof($arcade->games);
        if ($total_games > 1)
        {
            $total_games = sprintf($user->lang['ARCADE_TOTAL_GAMES'], $total_games);
        }
        else if ($total_games == 1)
        {
            $total_games = sprintf($user->lang['ARCADE_TOTAL_GAME'], $total_games);
        }

        $template->assign_vars(array(
            'S_DISPLAY_ARCADE'        => true,
            'TOTAL_GAMES_PLAYED'    => ($arcade->totals['games_played']) ? sprintf($user->lang['ARCADE_TOTAL_PLAYED'], $arcade->totals['games_played'], $arcade->format_time($arcade->totals['games_time'])) : '',
            'TOTAL_GAMES'            => $total_games,
        ));
        //Total Games
    }

    ?>
/styles/prosilver/template/portal/block/arcade.html

Code: Select all

    <?php
    /*
    *
    * @package phpBB3 Portal  a.k.a canverPortal  ( www.phpbb3portal.com )
    * @version $Id: links.php,v 1.4 2008/02/09 08:18:14 angelside Exp $
    * @copyright (c) Canver Software - www.canversoft.net
    * @license http://opensource.org/licenses/gpl-license.php GNU Public License 
    *
    */
    if (!defined('IN_PHPBB') or !defined('IN_PORTAL'))
    {
        die('Hacking attempt');
        exit;
    }

    if (file_exists($phpbb_root_path . 'includes/arcade/arcade_class.' . $phpEx))
    {
        include($phpbb_root_path . 'includes/arcade/arcade_class.' . $phpEx);        
        $arcade = new arcade(false);
        
        // Start of Top 3 Arcade Players
        $real_leaders_count = sizeof($arcade->leaders);
        $leaders_count = ($real_leaders_count > 3) ? 3 : $real_leaders_count;    

        $arcade_leaders_img = array();
        $arcade_leaders_img[0] = '';
        $arcade_leaders_img[1] = $phpbb_root_path . $arcade->config['image_path'] . '1st.gif';
        $arcade_leaders_img[2] = $phpbb_root_path . $arcade->config['image_path'] . '2nd.gif';
        $arcade_leaders_img[3] = $phpbb_root_path . $arcade->config['image_path'] . '3rd.gif';
        
        $arcade_leaders_img_alt = array();
        $arcade_leaders_img_alt[0] = '';
        $arcade_leaders_img_alt[1] = $user->lang['ARCADE_FIRST'];
        $arcade_leaders_img_alt[2] = $user->lang['ARCADE_SECOND'];
        $arcade_leaders_img_alt[3] = $user->lang['ARCADE_THIRD'];

        if ($leaders_count > 0)
        {
            $rank = 0;
            $actual_rank = 0;
            $previous_wins = 0;
            for ($i = 0; $i < $leaders_count; $i++)
            {
                //This code is used to calculate the actual rank.
                //For example if there are ties...
                $actual_rank++;
                if ($previous_wins != $arcade->leaders[$i]['total_wins'])
                {
                    $rank = $actual_rank;
                }
                $previous_wins = $arcade->leaders[$i]['total_wins'];

                $user_link = $arcade->format_username('full', $arcade->leaders[$i]['user_id'], $arcade->leaders[$i]['username'], $arcade->leaders[$i]['user_colour']);
                
                $template->assign_block_vars('arcade_leaders', array(
                    'ARCADE_LEADERS_RANK'        => $rank,
                    'ARCADE_LEADERS'             => $user_link,
                    'ARCADE_LEADERS_IMAGE'        => (isset($arcade_leaders_img[$rank])) ? $arcade_leaders_img[$rank] : '',
                    'ARCADE_LEADERS_IMAGE_ALT'    => (isset($arcade_leaders_img_alt[$rank])) ? $arcade_leaders_img_alt[$rank] : '',
                    'VICTORIES'                    => $arcade->leaders[$i]['total_wins']
                ));
            }
        }
        // End of Top 3 Arcade Players
        
        //Newest Game
        if (sizeof($arcade->newest_games))
        {
            $template->assign_vars(array(
                'S_HAS_NEWEST_GAME'        => true,
                'U_NEWEST_GAME_PLAY'    => append_sid("{$phpbb_root_path}arcade.$phpEx", 'mode=play&g=' . $arcade->newest_games[0]['game_id']),
                'NEWEST_GAME_IMAGE'        => ($arcade->newest_games[0]['game_image'] != '') ? $phpbb_root_path . "arcade.$phpEx?img=" . $arcade->newest_games[0]['game_image'] : '',
                'NEWEST_GAME_NAME'        => $arcade->newest_games[0]['game_name'],
            ));
        }
        //Newest Game
        
        //Total Games, Time and Plays
        $total_games = sizeof($arcade->games);
        if ($total_games > 1)
        {
            $total_games = sprintf($user->lang['ARCADE_TOTAL_GAMES'], $total_games);
        }
        else if ($total_games == 1)
        {
            $total_games = sprintf($user->lang['ARCADE_TOTAL_GAME'], $total_games);
        }

        $template->assign_vars(array(
            'S_DISPLAY_ARCADE'        => true,
            'TOTAL_GAMES_PLAYED'    => ($arcade->totals['games_played']) ? sprintf($user->lang['ARCADE_TOTAL_PLAYED'], $arcade->totals['games_played'], $arcade->format_time($arcade->totals['games_time'])) : '',
            'TOTAL_GAMES'            => $total_games,
        ));
        //Total Games
    }

    ?>
    <!-- IF S_DISPLAY_ARCADE -->
    <h3>Arcade Stats</h3>
    <div class="panel">
       <div class="inner"><span class="corners-top"><span></span></span>      
          <div class="content">
             <!-- IF S_HAS_NEWEST_GAME -->
             <p style="margin: 4px;"><!-- IF NEWEST_GAME_IMAGE --><a href="{U_NEWEST_GAME_PLAY}">Newest Game:<br /><img src="{NEWEST_GAME_IMAGE}" alt="{NEWEST_GAME_NAME}" width="20" height="20" style="vertical-align: middle;" /></a><!-- ENDIF -->&nbsp;{NEWEST_GAME_NAME}</p>
             <!-- ENDIF -->
             <!-- IF .arcade_leaders -->
             <br />
             <div>
                <b>{L_ARCADE_LEADERS_HEADER}</b><br />
                   <!-- BEGIN arcade_leaders -->
                      <!-- IF arcade_leaders.S_ROW_COUNT > 0 --> &nbsp;<!-- ENDIF --><!-- IF arcade_leaders.ARCADE_LEADERS_IMAGE --><img src="{arcade_leaders.ARCADE_LEADERS_IMAGE}" alt="{arcade_leaders.ARCADE_LEADERS_IMAGE_ALT}" style="vertical-align: middle;" /><!-- ENDIF -->&nbsp;&nbsp;{arcade_leaders.ARCADE_LEADERS_RANK}:&nbsp;{arcade_leaders.ARCADE_LEADERS}&nbsp;({arcade_leaders.VICTORIES})
                   <!-- END arcade_leaders -->
             </div>
             <!-- ENDIF -->
             <!-- IF TOTAL_GAMES -->
             <br />
             <p style="font-size: 12px;">{TOTAL_GAMES}<br />{TOTAL_GAMES_PLAYED}</p>
             <!-- ENDIF -->
          </div>      
       <span class="corners-bottom"><span></span></span></div>
    </div>
    <!-- ENDIF -->
Ausschnitt aus /styles/prosilver/template/portal/portal_body.html

Code: Select all

      <!-- IF S_DISPLAY_MINICAL -->
         <!-- INCLUDE portal/block/mini_calendar.html -->
      <!-- ENDIF -->
      
          <!-- INCLUDE portal/block/arcade.html -->
            
      <!-- IF S_DISPLAY_BIRTHDAY_LIST -->
         <!-- INCLUDE portal/block/birthday_list.html -->
      <!-- ENDIF -->
Angezeigt wird aber NICHTS , wo ist der ( mein ) Fehler ?

Re: Arcade-Block geht nicht ...

Posted: 29. March 2008 16:08
by Kevin
Ah - schau mal hier, ich hab da mal einen ungetesteten Workaround gemacht:
viewtopic.php?f=10&p=2852#p2852

Re: Arcade-Block geht nicht ...

Posted: 29. March 2008 16:10
by derkubi
Opps , zeitgleich mit meinem Beitrag , kein Wunder , daß ich das nicht gefunden habe .

Dieses Thema bitte löschen

Re: Arcade-Block geht nicht ...

Posted: 29. March 2008 16:11
by Kevin
Nein, nicht löschen, dieses Thema ist ja auf Deutsch. ;)

Re: Arcade-Block geht nicht ...

Posted: 29. March 2008 16:46
by derkubi
OK , dann mach ich mal auf Deutsch weiter

Nach Änderung/Erstellen der Dateien bekomme ich folgende Fehlermeldung :
Fatal error: Cannot redeclare class arcade in /srv/www/httpd/phost/d/com/pytalhost/dienstagstruppe/web/includes/arcade/arcade_class.php on line 24

Tip von KEVIN
Kevin wrote:Hm, try removing this line from the arcade.php

Code: Select all

include($phpbb_root_path . 'includes/arcade/arcade_class.' . $phpEx);  
Jetzt der Fehler :
Fatal error: Class 'arcade' not found in /srv/www/httpd/phost/d/com/pytalhost/dienstagstruppe/web/portal/block/arcade.php on line 11

Frage : für welche Acrade-Version hast Du das geschrieben ?

Re: Arcade-Block geht nicht ...

Posted: 29. March 2008 17:14
by Kevin
Ich hab das weder geschrieben, noch kenne ich den Mod.
Der Code kommt, wie im anderen Thread schon geschrieben, von hier: http://www.phpbb.com/community/viewtopi ... 5#p4786955

Re: Arcade-Block geht nicht ...

Posted: 29. March 2008 19:13
by derkubi
Hab da mal angefragt , Antwort :

My big problem 1st thing was, I use a subsilver based style and was too dumb to rewrite the code for it.

Re: Arcade-Block geht nicht ...

Posted: 12. May 2008 22:13
by derkubi
Mittlerweile gibt es seit 1.0.0 ja die Custom Blocks . Kennt jemand ein Script , das ArcadeTopplayer , Highscores oder sowas anzeigt ?

Was ist mit einem Block für Subsilver ?