it shows error :-
XML Parsing Error: XML or text declaration not at start of entity
it shows error :-
XML Parsing Error: XML or text declaration not at start of entity
Different error here:
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. The following tags were not closed: urlset. Error processing resource 'http://yourgasm.net/sitemap.php'.
This works - save as sitemap.php
Code:<?php echo "<?xml version='1.0' encoding='iso-8859-1'?>"; echo "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">"; // hostname on which MySQL is (usally localhost) $dbhost = "localhost"; // Database name $dbname = ""; // Username $dbuser = ""; // Password $dbpass = ""; // mysql_connect() fnction $conn = mysql_connect($dbhost,$dbuser,$dbpass) or die("Unable to connect to MySQL."); // mysql_select_db() function mysql_select_db($dbname,$conn) or die("Unable to connect to Database $dbname"); $sql = "Select VID, title, description, adddate, flvdoname, duration from video where approve=1 and active=1"; // execute SQL Command $res = mysql_query($sql,$conn) or die( "Error: " . mysql_error() ); // Retrieve Results while ($info = mysql_fetch_row($res)) { $SefUrl=strtolower(preg_replace("/[^a-zA-Z0-9]+/","_", $info[1])); echo "<url><loc>http://www.site.com/video/".$info[0]."/".$SefUrl."/</loc></url>"; } echo "</urlset>"; // mysql_close() function mysql_close($conn); ?>
Can't the db login stuff be eliminated by using the config include?
require 'include/config.php';
and instead of this echo "<url><loc>http://www.site.com/video/".$info[0]."/".$SefUrl."/</loc></url>";
put echo "<url><loc>{$base_url}/video/".$info[0]."/".$SefUrl."/</loc></url>";
or will that bork the whole thing....Imma go try it.
If it's not fun, stop doing it!
I made it as a stand alone script. But both ways are fine
Yeah, the inlude works but I think the DB stuff needs to be this:
$sql = "Select video_id, video_title, video_description, video_add_date, video_flv_name, video_length from videos where video_approve=1 and video_active=1";
If it's not fun, stop doing it!
Nepal's Largest video community portal. share wisely at WWW.CLONEVIDEOS.COM
Bookmarks