sto provando a creare una videositemap in xml,
non sono pratico di programmazione...sono ad un punto che non riesco a vedere l'errore;
quindi chiedo il vostro aiuto!
vi posto il codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
</head>
<body>
<?php
$host = "localhost";
$user = "root";
$pass = "password";
$database = "provadb";
$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host.");
mysql_select_db($database, $linkID) or die("Could not find database.");
$query = "SELECT * FROM news_profile ORDER BY id DESC";
$resultID = mysql_query($query, $linkID) or die("Data not found.");
$file= fopen("wright.xml", "a+");
$xml_output = "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
$xml_output .= "<xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\">\n";
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$row['title'] = str_replace("&", "&", $row['title']);
$row['title'] = str_replace("<", "<", $row['title']);
$row['title'] = str_replace(">", ">", $row['title']);
$row['title'] = str_replace("\"", """, $row['title']);
$row['data'] = str_replace("&", "&", $row['data']);
$row['data'] = str_replace("<", "<", $row['data']);
$row['data'] = str_replace(">", ">", $row['data']);
$row['data'] = str_replace("\"", """, $row['data']);
$xml_output .= "\t<url>\n";
$xml_output .= "\t\t<loc>" . $row['title'] . "</loc>\n";
$xml_output .= "\t\t<video:video>\n";
$xml_output .= "\t\t<video:content_loc>http://www.site.com/video123.flv</video:content_loc>\n";
$xml_output .= "\t\t<videolayer_loc allow_embed="yes">http://www.site.com/videoplayer.swf?video=123</video
layer_loc>\n";
$xml_output .= "\t\t<video:thumbnail_loc>http://www.example.com/thumbs/123.jpg</video:thumbnail_loc>\n";
$xml_output .= "\t\t<video:title>" . $row['title'] . "</video:title>\n";
$xml_output .= "\t\t<video:description>'Come ottenere bistecche sempre perfette'</video:description>\n";
$xml_output .= "\t\t<video:rating>"4.2"</video:rating>\n";
$xml_output .= "\t\t<video:view_count>"12345"</video:view_count>\n";
$xml_output .= "\t\t<videoublication_date>2007-11-05T19:20:30+08:00.</video
ublication_date>\n";
$xml_output .= "\t\t<video:expiration_date>2009-11-05T19:20:30+08:00.</video:expiration_date>\n";
$xml_output .= "\t\t<video:tag>'bistecca'</video:tag>\n";
$xml_output .= "\t\t<video:tag>'carne'</video:tag>\n";
$xml_output .= "\t\t<video:tag>'estate'</video:tag>\n";
$xml_output .= "\t\t<video:category>'Barbecue'</video:category>\n";
$xml_output .= "\t\t<video:family_friendly>yes</video:family_friendly>\n";
$xml_output .= "\t\t<video:expiration_date>2009-11-05T19:20:30+08:00<video:expiration_date>\n";
$xml_output .= "\t\t<video:duration>600</video:duration>\n";
$xml_output .= "\t\t</video:video>\n";
$xml_output .= "\t</url>\n";
}
$xml_output .= "</urlset>\n";
fwrite($file, $xml_output);
// echo "XML has been written. <a href=\"wright.xml\">View the XML.</a>";
fclose($xml_output);
?>
</body>
</html>
GRAZIE A CHI RISPONDE!![]()