Frågan#1
Hej,
plockar ut en serietabell från en extern sida med följande kod
<table border="0" cellspacing="0" cellpadding="0">
<tr style="font-size: 11px; font-family: Tahoma; color: #FFFFFF">
<td width="100"> </td>
<td width="50" align="center"><b> </b></td>
<td width="30" align="center"><b> </b></td>
<td width="30" align="center"><b> </b></td>
<td width="30" align="center"><b> </b></td>
<td width="60" align="center"><b> </b></td>
<td width="30" align="center"><b> </b></td>
</tr>
<?php
$site = file_get_contents("http://www.svenskfotboll.se/goteborg/Table.ASP?TournamentId=37436");
preg_match_all('/<a href=\"organisation.*?\/a>/i', $site, $team); // Lagen
preg_match_all('/<td align=\"center\" nowrap>(.*?)<\/td>/i', $site, $matches); // resultaten
$list = array_chunk($matches[1],6);
unset($matches); //släng bort $matches, den har gjort sitt
foreach($team[0] as $key => $value) {
$i++; //räknare
// Rätta till länkarna...
$team = preg_replace('/<a href=\"(.*\")>/', '<a hhref="http://www.svenskfotboll.se/goteborg/\\1 target="_blank">', $value);
// Bakgrundsfärg...
$color = ($color == "#aa0000") ? "#aa0000" : "#aa0000";
// Skriv ut tabellen
echo("<tr height=20 bgcolor=\"$color\"><td width=90 align=left style=\"font-family: Tahoma; font-weight: bold; color: #FFFFFF; font-size: 11px\"> $team</td>\n");
// loopa ut resultaten
for($t=0; $t < 6; $t++) {
echo("<td align=center style=\"font-family: Tahoma; color: #FFFFFF; font-size: 11px\">". $list[$key][$t] ."</td>\n");
}
echo("</tr>\n");
}
?>
</table>
Är det möjligt att skriva ut raden som innehåller önskat lag med fet stil, typ highlight-a?