Page 1 of 1

Eigener Protal Block

Posted: 20. February 2012 12:33
by dezender
Würde gern einen Portal Block erstellen.
Irgendwie find ich nur Anleitungen dazu fürs Portal 1.XX

Der Portalblock solte folgende Informationen ausgeben:

Code: Select all

    <?php
    if (!defined('IN_PHPBB'))
    {
       exit;
    }

    if (!defined('IN_PORTAL'))
    {
       exit;
    }

    // config
    $status_url = "/usr/games/helix/HELI-X40/files/Server/status.log";
    $headline = 'Pilotenliste vom HTB-Server für den Heli-X';
    $error_text = 'Der Heli-X Server auf Helitreffenberlin ist derzeit nicht verfügbar!';

    if ($lines = @file($status_url)) {
            $airport = $lines[1];
            $pilot_count = $lines[2]+0;

            for ($i=3; $i <= count($lines); $i++) {
                    $template->assign_block_vars('pilotrow', array(
                            'HELIX_PILOT_NAME' => htmlentities(substr($lines[$i],0,30))
                    ));
            }
            $template->assign_vars(array(
                    'PORTAL_HELIX_HEADLINE' => $headline,
                    'HELIX_AIRPORT' => $airport,
                    'HELIX_PILOT_COUNT' => $pilot_count,
            ));
    } else {
            $template->assign_vars(array(
                    'PORTAL_HELIX_HEADLINE' => $headline,
                    'HELIX_AIRPORT' => $error_text,
                    'HELIX_PILOT_COUNT' => $pilot_count,
                    'HELIX_ERROR' => true,
            ));
    }

    ?>
Und das Template solte so ausschaun:

Code: Select all

{$C_BLOCK_H_L}<dt>{PORTAL_HELIX_HEADLINE}</dt>{$C_BLOCK_H_R}
<div class="panel" style="margin-bottom: 0px">
        <div class="inner"><span class="portal-corners-top-inner"></span>
                <div class="postbody" style="width: 100%">
                        <div class="content">
                                Airport: {HELIX_AIRPORT}
                                <!-- IF not HELIX_ERROR -->
                                        (Piloten: {HELIX_PILOT_COUNT})
                                        <br />
                                        <!-- BEGIN pilotrow -->
                                                {pilotrow.HELIX_PILOT_NAME}&nbsp;
                                        <!-- END pilotrow -->
                                <!-- ENDIF -->
                        </div>
                </div>
        <span class="portal-corners-bottom-inner"></span></div>
</div>
{$C_BLOCK_F_L}{$C_BLOCK_F_R}

Nur wo erstell ich die Datein und bekomm diese dann im ACP Portal zur Auswahl angezeigt?

Re: Eigener Protal Block

Posted: 20. February 2012 17:40
by Kirk
Hallo
Schau doch hier mal rein da ist alles beschrieben
knowledge/kb_show.php?id=58
knowledge/kb_show.php?id=57