Dołącz do zespołu ekspertów! Backend lub Frontend Developer?

Sprawdź najnowsze oferty pracy naszego partnera - 8lines.io!

Informacje o serwerze w popupie.

PHP/MYSQL  Założony przez  GiboneKPL.

Witam. O tuż chciałem dodać do CsBoard informacje o serwerze w popupie (popup w budowie :P). Ale teraz jak mam 2 serwery to wyświetla mi info cały czas z tego 1 (nawet jeśli klikam na info o 2). Wiem tyle że to trzeba jakoś po $id i trzeba potem go "podpiąć" pod tabelkę, ale nie wiem jak :/


Oczywiście strona: http://gibon-testuje.xaa.pl/index.php :)
Ja już wiem jak ale same chęci to za mało. Szukasz jakiegoś punktu zaczepienia. Dla mnie takim punktem jest port serwera. Nadajesz tabelce takie same ID (port) jak w linku do puopa. Następnie wyświetlasz dane z pętli. Pamiętaj o jednym. Ile jest serwerów - tyle musi być okienek popu. Czyli musisz stworzyć pętlę, która będzie sprawdzała ile jest serwerów i ile do nich tabelek dorobić. Tyle w teorii czas zrobić to w praktyce :D
Jako tako mi Every pomógł tylko żeby sprawdzić potrzebuje wyświetlić popupa, a na co mu się chyba nie spieszy.. (Mówię o popupie). Nie wyświetla mi się on choć mam wszystko dodane. Tak wyglądają templatki:
$template_table '<table border="0" cellspacing="1" cellpadding="3" class="tborder">
        <tr>
        <td class="thead" align="center" colspan="8">
        <strong>{$lang->csboard_serverlist}</strong> {$collapse}
        </td>
        </tr>
        <tbody style="{$expdisplay}" id="cs_board_e">
        <tr>
        <td class="tcat" colspan="0"><span class="smalltext"><strong>{$lang->csboard_status}</strong></span></td>
        <td class="tcat" colspan="0"><span class="smalltext"><strong>{$lang->csboard_name}</strong></span></td>
        <td class="tcat" colspan="0"><span class="smalltext"><strong>{$lang->csboard_ip}</strong></span></td>
        <td class="tcat" colspan="0"><span class="smalltext"><strong>{$lang->csboard_slots}</strong></span></td>
        <td class="tcat" colspan="0"><span class="smalltext"><strong>{$lang->csboard_maps}</strong></span></td>
        <td class="tcat" colspan="0"><span class="smalltext"><strong>{$lang->csboard_type}</strong></span></td>
        <td class="tcat" colspan="0"><span class="smalltext"><strong>{$lang->csboard_other}</strong></span></td></tr>
        {$csboard_row}
        {$csboard_summation}
        <tbody></table><br />
        <script type="text/javascript" src="{$mybb->settings[\'bburl\']}/jscripts/csboard_popup.js"></script>'
;
    
$template_popup '<div id="csboard_box" class="csboard_box csboard_box">
    <div class="theadpanelu">Informacje o serwerze<span style="float:right;margin:6px;background:#191919 url(images/CsBoard/highlight.png)top left repeat-x;padding:3px;border-radius:1px;"><a rel="close_csboard" href="#" title="Zamknij"><font color="#FFFFFF">X</font></a></span></div>
            <div class="csboard_box_Content csboard_box_Content"><table class="serverstable">
                                    <tbody><tr>
                                        <td rowspan="4" style="width:164px">
                                            <div style="width:160px; padding:2px; position:relative; margin:auto">
                                                <img src=\'http://cs-spark.eu/others/tabela/other/map_no_image.jpg\' style="vertical-align:middle">
                                                <img src=\'http://cs-spark.eu/others/tabela/other/map_overlay.gif\' style="position:absolute; z-index:2; top:0px; left:0px;">
                                                <img src=\'http://cs-spark.eu/others/tabela/icons/halflife/cstrike.gif\' title="[ Typ: halflife ] [ Gra: cstrike ]" style="position:absolute; z-index:2; top:6px; left:6px;">
                                                <img src=\'http://cs-spark.eu/others/tabela/locations/OFF.png\' title="" style="position:absolute; z-index:2; top:6px; right:6px;">
                                            </div>
                                        </td>
                                        
                                        <td><b>Status:</b></td>
                                        <td><img src=\'http://cs-spark.eu/others/tabela/other/icon_online.png\'/></td>
                                        <td><b>Adres:</b></td>
                                        <td>{$conf[\'ip\']}:{$conf[\'port\']}</td>
                                        </tr>
                                        <tr>
                                        <td><b>Typ:</b></td>
                                        <td>halflife</td>
                                        <td><b>Gra:</b></td>
                                        <td>cstrike</td>
                                        </tr>
                                        <tr>
                                        <td><b>Graczy:</b></td>
                                        <td>{$info[\'totalplayers\']}/{$info[\'maxplayers\']}</td>
                                        <td><b>Mapa:</b></td>
                                        <td>Jakaś mapa</td>
                                        </tr>
                                        <tr>
                                        <td><b>Pozostały czas:</b></td>
                                        <td>brak info</td>
                                        <td><b>Następna mapa:</b></td>
                                        <td>brak info</td>
                                        </tr>
                                        <tr>
                                        <td colspan="5">
                                          <div style="float:right;">
                                          {$gt1}{$conf[\'ip\']}:{$conf[\'port\']}{$gt2}
                                            
                                        {$wk1}{$conf[\'ip\']}:{$conf[\'port\']}{$wk2}
                                        
                                        {$hl1}{$conf[\'ip\']}:{$conf[\'port\']}{$hl2}
                                        </div>
                                        </td>
                                        </tr>
                                    <tr>
                                </tr></tbody></table></div></div>'
;
    
$template_row '<tr>
        <td class="trow2"> <span class="smalltext">{$info[\'serverlocked\']}</span></td>
        <td class="trow2"> <span class="smalltext">{$info[\'name\']}</span></td>
        <td class="trow2"> <span class="smalltext">{$conf[\'ip\']}:{$conf[\'port\']}</span></td>
        <td class="trow2"> <span class="smalltext">{$info[\'totalplayers\']}/{$info[\'maxplayers\']}</span></td>
        <td class="trow2"> <span class="smalltext">{$info[\'map\']}</span></td>
        <td class="trow2"> <span class="smalltext">{$cs[\'rodzaj\']}</span></td>
        <td class="trow2"> <span class="smalltext"> <a href="#" name="csboard" rel="#csboard_box"><img src="{$mybb->settings[\'bburl\']}/images/CsBoard/icon_other.png"/>Pokaż</a> <div id="mask"></div>{$csboard_popup}</td></tr>'
;
    
$template_summation '<tr><td class="trow1" align="center" colspan="7"> {$lang->csboard_servers} <span class="csboard_info">{$servers}</span>  {$lang->csboard_allplayers} <span class="csboard_info">{$players}</span>  {$lang->csboard_allslots} <span class="csboard_info">{$slots}</span> {$lang->csboard_freeslots} <span class="csboard_info">{$freeslots}</span></td></tr>'

Help me please :)
@Ripley, ripley! Trochę to z edytowałem i teraz wygląda to tak:

Szablony:
$template_row '<tr>
        <td class="trow2"> <span class="smalltext">{$info[\'serverlocked\']}</span></td>
        <td class="trow2"> <span class="smalltext">{$info[\'name\']}</span></td>
        <td class="trow2"> <span class="smalltext">{$conf[\'ip\']}:{$conf[\'port\']}</span></td>
        <td class="trow2"> <span class="smalltext">{$info[\'totalplayers\']}/{$info[\'maxplayers\']}</span></td>
        <td class="trow2"> <span class="smalltext">{$info[\'map\']}</span></td>
        <td class="trow2"> <span class="smalltext">{$cs[\'rodzaj\']}</span></td>
        <td class="trow2"> <span class="smalltext"> <a href="#" name="csboard" rel="#csboard_box {$csboard_popup}"><img src="{$mybb->settings[\'bburl\']}/images/CsBoard/icon_other.png"/>Pokaż</a> <div id="mask"></div><div id="csboard_box" class="csboard_box csboard_box">    <div class="theadpanelu">Informacje o serwerze<span style="float:right;margin:6px;background:#191919 url(images/CsBoard/highlight.png)top left repeat-x;padding:3px;border-radius:1px;"><a rel="close_csboard" href="#" title="Zamknij"><font color="#FFFFFF">X</font></a></span></div>
            <div class="csboard_box_Content csboard_box_Content">{$csboard_popup}</div></td></tr>'
;
    
$template_popup '<table class="serverstable">
                                    <tbody><tr>
                                        <td rowspan="4" style="width:164px">
                                            <div style="width:160px; padding:2px; position:relative; margin:auto">
                                                <img src=\'http://cs-spark.eu/others/tabela/other/map_no_image.jpg\' style="vertical-align:middle">
                                                <img src=\'http://cs-spark.eu/others/tabela/other/map_overlay.gif\' style="position:absolute; z-index:2; top:0px; left:0px;">
                                                <img src=\'http://cs-spark.eu/others/tabela/icons/halflife/cstrike.gif\' title="[ Typ: halflife ] [ Gra: cstrike ]" style="position:absolute; z-index:2; top:6px; left:6px;">
                                                <img src=\'http://cs-spark.eu/others/tabela/locations/OFF.png\' title="" style="position:absolute; z-index:2; top:6px; right:6px;">
                                            </div>
                                        </td>
                                        
                                        <td><b>Status:</b></td>
                                        <td><img src=\'http://cs-spark.eu/others/tabela/other/icon_online.png\'/></td>
                                        <td><b>Adres:</b></td>
                                        <td>{$conf[\'ip\']}:{$conf[\'port\']}</td>
                                        </tr>
                                        <tr>
                                        <td><b>Typ:</b></td>
                                        <td>halflife</td>
                                        <td><b>Gra:</b></td>
                                        <td>cstrike</td>
                                        </tr>
                                        <tr>
                                        <td><b>Graczy:</b></td>
                                        <td>{$info[\'totalplayers\']}/{$info[\'maxplayers\']}</td>
                                        <td><b>Mapa:</b></td>
                                        <td>Jakaś mapa</td>
                                        </tr>
                                        <tr>
                                        <td><b>Pozostały czas:</b></td>
                                        <td>brak info</td>
                                        <td><b>Następna mapa:</b></td>
                                        <td>brak info</td>
                                        </tr>
                                        <tr>
                                        <td colspan="5">
                                          <div style="float:right;">
                                          {$gt1}{$conf[\'ip\']}:{$conf[\'port\']}{$gt2}
                                            
                                        {$wk1}{$conf[\'ip\']}:{$conf[\'port\']}{$wk2}
                                        
                                        {$hl1}{$conf[\'ip\']}:{$conf[\'port\']}{$hl2}
                                        </div>
                                        </td>
                                        </tr>
                                    <tr>
                                </tr></tbody></table>'


A tutaj kod pliku *.js:
/**
* Modal Boxes JS
*
* @author Euan T. <euan@euantor.com>
* @version 1.0.0
*/

jQuery.noConflict();

jQuery(document).ready(function($)
{
    
    
jQuery('#csboard_box input[name="url"]').attr("value"window.location);

    
// Modal Boxes //
    
jQuery('a[name="csboard"]').on('click', function(event)
    {
        
event.preventDefault();
        
        var 
target = $(this).attr('rel');
        
        
// Set up the shadowing
        
var maskHeight jQuery(document).height();
        var 
maskWidth jQuery(window).width();
        
jQuery('#mask').css({'width'maskWidth'height'maskHeight});
        
jQuery('#mask').fadeIn(800);    
        
jQuery('#mask').fadeTo("slow"0.5);  
        
        
// Position the actual modal
        
var winH jQuery(window).height();
        var 
winW jQuery(window).width();
        
jQuery(target).css('top',  (winH 2) - (jQuery(target).height() / 2));
        
jQuery(target).css('left', (winW 2) - (jQuery(target).width() / 2));
        
jQuery(target).fadeIn(600); 
    });

    
jQuery('.csboard_box a[rel="close_csboard"]').on('click', function(event)
    {
        
event.preventDefault();
        
jQuery('#mask, .csboard_box, csboard_box_box').fadeOut(600);
    }); 

    
jQuery('#mask').on('fadeOut(800)', function ()
    {
        
jQuery(this).hide();
        
jQuery('.csboard_box').hide();
    });     
        

}); 

Popup się pokazuje ale nie wczytuje danych z osobnego szablonu. :/ Czy to trzeba by było w pliku *.js edytować też?

Tutaj strona: http://gibon-testuje.xaa.pl/index.php
Musisz to zrobić w ajaxie.



Użytkownicy przeglądający ten wątek:

1 gości