Autor Zpráva
carlos202
Profil
Ahoj, zobrazuju na svých stránkách pomocí preg_match tabulku výsledků ze stránky baseball.cz a potřeboval bych aby se mi zobrazovala jenom část té tabulky (viz. obrázek červené ohraničení)


Věděl byste prosím někdo jak na to? :)

html kód tabulky
<table>
                          
        <TR class=tab_head>
            <th noWrap>&nbsp;</th>
            <th noWrap>&nbsp;</th>
            <th noWrap align=center>&nbsp;W&nbsp;</th>
            <th noWrap align=center>&nbsp;L&nbsp;</th>
            <th noWrap align=center>&nbsp;%&nbsp;</th>
            <th noWrap align=center>&nbsp;GB&nbsp;</th>
            <th noWrap align=center>&nbsp;BA&nbsp;</th>
            <th noWrap align=center>&nbsp;ERA&nbsp;</th>
            <th noWrap align=center>&nbsp;SKÓRE&nbsp;</th>
            <th noWrap align=center>&nbsp;</th>
        </TR>
     <TR>
     <TD align=center><img src="/subdom/plzen/images/tymy/DOM.png" border=0 height=47></TD>
     <TD noWrap class="nazev">Wolfs Domažlice</TD>
     <TD align=center>10</TD>
     <TD align=center>4</TD><TD align=center>0.714</TD>
     <TD align=center>0</TD>
     <TD align=center>0</TD>
     <TD align=center>0</TD>
     <TD align=center>140:113</TD>
     <TD align=center  ><button onclick="location.href='modules.php?op=modload&name=liga&file=index&do=tab&akce=309&pda=2&admina=&atid=1862';">Hráči</button></TD>
     </TR>
     <TR>
     <TD align=center><img src="/subdom/plzen/images/tymy/SPO.png" border=0 height=47></TD>
     <TD noWrap class="nazev">Sharks Spálené Poříčí</TD>
     <TD align=center>7</TD>
     <TD align=center>3</TD><TD align=center>0.700</TD>
     <TD align=center>1</TD>
     <TD align=center>0</TD>
     <TD align=center>0</TD>
     <TD align=center>150:112</TD>
     <TD align=center  class="last"><button onclick="location.href='modules.php?op=modload&name=liga&file=index&do=tab&akce=309&pda=2&admina=&atid=1863';">Hráči</button></TD>
     </TR>
     <TR>
     <TD align=center><img src="/subdom/plzen/images/tymy/BPL.png" border=0 height=47></TD>
     <TD noWrap class="nazev">Baseball Plzeň</TD>
     <TD align=center>8</TD>
     <TD align=center>8</TD><TD align=center>0.500</TD>
     <TD align=center>3</TD>
     <TD align=center>0</TD>
     <TD align=center>0</TD>
     <TD align=center>181:178</TD>
     <TD align=center  class="last"><button onclick="location.href='modules.php?op=modload&name=liga&file=index&do=tab&akce=309&pda=2&admina=&atid=1861';">Hráči</button></TD>
     </TR>
     <TR>
     <TD align=center><img src="/subdom/plzen/images/tymy/SLA.png" border=0 height=47></TD>
     <TD noWrap class="nazev">Slavia VŠ Plzeň</TD>
     <TD align=center>5</TD>
     <TD align=center>7</TD><TD align=center>0.417</TD>
     <TD align=center>4</TD>
     <TD align=center>0</TD>
     <TD align=center>0</TD>
     <TD align=center>177:198</TD>
     <TD align=center  class="last"><button onclick="location.href='modules.php?op=modload&name=liga&file=index&do=tab&akce=309&pda=2&admina=&atid=1904';">Hráči</button></TD>
     </TR>
     <TR>
     <TD align=center><img src="/subdom/plzen/images/tymy/MER.png" border=0 height=47></TD>
     <TD noWrap class="nazev">SC Merklín</TD>
     <TD align=center>4</TD>
     <TD align=center>12</TD><TD align=center>0.250</TD>
     <TD align=center>7</TD>
     <TD align=center>0</TD>
     <TD align=center>0</TD>
     <TD align=center>210:257</TD>
     <TD align=center  class="last"><button onclick="location.href='modules.php?op=modload&name=liga&file=index&do=tab&akce=309&pda=2&admina=&atid=1864';">Hráči</button></TD>
     </TR>    </table>

kód kterým zobrazuju tabulku z baseball cz
<?php  
header('Content-Type: text/html; charset=utf-8');

echo showSoccerTable('http://www.baseball.cz/modules.php?op=modload&name=liga&file=index&do=tab&akce=309&pda=2&admina='); 



/** 
 * showSoccerTable() 
 *  
 * Funkce umoznuje parsovat fotbalove tabulky  
 *  
 * @date 28/05/2010 
 * @author Roman Janko <admin@rjwebdesign.net>      
 * @param string $url  nacitame konkretni tabulku  
 * @param integer $ttl  nastavujeme dobu expirace stahovani, defaultne 3600 (1 hodina) 
 * @return string 
 *   
 */ 
function showSoccerTable($url = '', $ttl = 3600) 
{ 
    // vychozi priznak 
    $cached = true; 
     
    // nenalezen soubor nebo probehl expiraci 
    if (!is_file("./cache/" . md5($url)) || time() -  filemtime("./cache/" . md5($url)) > $ttl) 
        $cached = false; 
             
    // neni kesovano 
    if (!$cached) 
    {    
        // debug 
        //echo "znovu parsujeme tabulku - " . date('d.m.Y H:i:s'); 
         
        $f        = file_get_contents($url); 
        if (!$f) 
        { 
            echo 'Nelze načíst - ' . $url ; 
            return; 
        } 
         
        $table    = preg_match('~<tbody>(.+?)</tbody>~s', $f, $out); 
        
        $my_table = $out[1]; 
        
        $my_table = "<table>".$my_table."</table>";
               
        $ourTable = iconv('windows-1250','utf-8',$my_table);
       
         //$html_utf8 = mb_convert_encoding($ourTable, "utf-8", "windows-1250");
     
        // ulozime 
        file_put_contents("./cache/".md5($url), $ourTable); 
    } 

        // nacteme tabulku 
        $table = file_get_contents("./cache/".md5($url)); 
        
        
       
        return $table; 
     
} 




?> 
anonymníí
Profil *
carlos202:
Pokud by ti stačilo ten kousek pouze nezobrazit, tak můžeš použít následující.

tr > * + * + * + * + * + * {display: none;}

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0