Jeg har lavet en der viser nuværende program hvis det var noget:
www.dugi.1go.dk/hosting/TV-Guide/Koden kan du få her:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
<title>TV-Guide</title>
</head>
<body>
<table style="width: 203px; height: 96px\" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 203px; font-family: Tahoma; font-size: 15px; color: #000000; font-weight: bold">TV lige nu</td>
</tr>
<tr>
<td style="width: 203px; height: 5px"></td>
</tr>
<tr>
<td style="width: 203px">
<table style="width: 203px; height: 96px\" border="0" cellspacing="0" cellpadding="0">
<?php
$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";
$pubdate = "";
function startendetag($parser, $name, $attrs)
{
global $insideitem, $tag, $title, $description, $link, $pubdate;
if ($insideitem)
{
$tag = $name;
}
elseif ($name == "ITEM")
{
$insideitem = true;
}
}
function afslutendetag($parser, $name)
{
global $insideitem, $tag, $title, $description, $link, $pubdate;
if ($name == "ITEM")
{
$title = str_replace(" ","",$title);
if (substr($title, 0, 5) == "[DR1]")
{
print "
<tr>
<td width=\"24\" height=\"20\"><img src=\"images/dr1.png\" width=\"20\" height=\"20\" title=\"DR1\"></td>
<td width=\"179\" style=\"font-family: Tahoma; font-size: 10px; color: #000000\">".substr($pubdate, 30, 5)." - ".substr(htmlspecialchars(trim($title)), 6)."</td>
</tr>
";
}
elseif (substr($title, 0, 5) == "[TV2]")
{
print "
<tr>
<td width=\"24\" height=\"20\" bgcolor=\"#F5F5F5\"><img src=\"images/tv2.png\" width=\"20\" height=\"20\" title=\"TV2\"></td>
<td width=\"179\" style=\"font-family: Tahoma; font-size: 10px; color: #000000\" bgcolor=\"#F5F5F5\" align=\"left\">".substr($pubdate, 30, 5)." - ".substr(htmlspecialchars(trim($title)), 6)."</td>
</tr>
";
}
elseif (substr($title, 0, 5) == "[TV3]")
{
print "
<tr>
<td width=\"24\" height=\"20\"><img src=\"images/tv3.png\" width=\"20\" height=\"20\" title=\"TV3\"></td>
<td width=\"179\" style=\"font-family: Tahoma; font-size: 10px; color: #000000\">".substr($pubdate, 30, 5)." - ".substr(htmlspecialchars(trim($title)), 6)."</td>
</tr>
";
}
elseif (substr($title, 0, 6) == "[TV3+]")
{
print "
<tr>
<td width=\"24\" height=\"20\" bgcolor=\"#F5F5F5\"><img src=\"images/tv3plus.png\" width=\"20\" height=\"20\" title=\"DR1\"></td>
<td width=\"179\" style=\"font-family: Tahoma; font-size: 10px; color: #000000\" bgcolor=\"#F5F5F5\">".substr($pubdate, 30, 5)." - ".substr(htmlspecialchars(trim($title)), 7)."</td>
</tr>
";
}
elseif (substr($title, 0, 12) == "[TV Danmark]")
{
print "
<tr>
<td width=\"24\" height=\"20\"><img src=\"images/tvdanmark.png\" width=\"20\" height=\"20\" title=\"DR1\"></td>
<td width=\"179\" style=\"font-family: Tahoma; font-size: 10px; color: #000000\">".substr($pubdate, 30, 5)." - ".substr(htmlspecialchars(trim($title)), 13)."</td>
</tr>
";
}
elseif (substr($title, 0, 9) == "[Kanal 5]")
{
print "
<tr>
<td width=\"24\" height=\"20\" bgcolor=\"#F5F5F5\"><img src=\"images/kanal5.png\" width=\"20\" height=\"20\" title=\"DR1\"></td>
<td width=\"179\" style=\"font-family: Tahoma; font-size: 10px; color: #000000\" bgcolor=\"#F5F5F5\">".substr($pubdate, 30, 5)." - ".substr(htmlspecialchars(trim($title)), 10)."</td>
</tr>
";
}
$title = "";
$description = "";
$link = "";
$pubdate = "";
$insideitem = false;
}
}
function mellemtag($parser, $data)
{
global $insideitem, $tag, $title, $description, $link, $pubdate;
if ($insideitem)
{
switch ($tag)
{
case "TITLE":
$title .= $data;
break;
case "DESCRIPTION":
$description .= $data;
break;
case "LINK":
$link .= $data;
break;
case "PUBDATE":
$pubdate .= $data;
break;
}
}
}
$xmlconn = xml_parser_create("ISO-8859-1");
xml_set_element_handler($xmlconn, "startendetag", "afslutendetag");
xml_set_character_data_handler($xmlconn, "mellemtag");
$henturl = fopen("
http://ontv.dk/rss/","r") or die("Kunne ikke læse RSS data'en");
while ($data = fread($henturl, 4096))
{
xml_parse($xmlconn, $data, feof($henturl)) or die(sprintf("XML fejl: \"%s\" på linie %d", xml_error_string(xml_get_error_code($xmlconn)), xml_get_current_line_number($xmlconn)));
}
?>
</table>
</td>
</tr>
</table>
</body>
</html>