This is simple code to generate xml sitemap using php. This code generates xml sitemap depending on sql query and it can support unlimited url (no url limit). On SEO point of view, the sitemap can be updated very frequently which is very big plus for your site SEO.
Read more to Get the code for generating xml sitemap –>
<?php
function makesitemap($url)
{
$file= fopen($url, “w”);
include_once(“connect.php”); //database parameters
$query = “SELECT id,title FROM articles order by added_on desc”;
$xml_outputĀ = “<?xml version=\”1.0\” encoding=\”UTF-8\”?>\n”;
$xml_outputĀ .= “<urlset xmlns=\”http://www.google.com/schemas/sitemap/0.84\”>\n”;
$xml_output.=”<!– Latest dumps sitemap generator at www.dumpsquestions.com –>”;
while($row=mysql_fetch_array($result))
{
$xml_output .= “\t<url>\n”;
/* $row['text'] = str_replace(“&”, “&”, $row['title']);
$row['text'] = str_replace(“<”, “<”, $row['title']);
$row['text'] = str_replace(“>”, “>”, $row['title']);
$row['text'] = str_replace(“\”", “"”, $row['title']);*/
$xml_output .= “\t\t<loc>http://www.dumpsquestions.com/how_to/”.$row['title'].”_”.$row['id'] .”.html</loc>\n”;
$xml_output .= “\t\t<lastmod>”.date(‘Y’).”-”.date(‘m’).”-”.date(‘d’).”</lastmod>\n”;
$xml_output .= “\t\t<changefreq>weekly</changefreq>\n”;
$xml_output .= “\t\t<priority>0.8</priority>”;
$xml_output.=”\n”;
$xml_output .= “\t</url>\n”;
}
$xml_output .= “</urlset>”;
//echo $xml_output;
fwrite($file, $xml_output);
fclose($file);
}
makesitemap(“sitemap-article.xml”);
?>
No related posts.



Dumps Questions










October 16th, 2009 at 7:00 pm
Hello from Russia!
Can I quote a post in your blog with the link to you?
October 21st, 2009 at 5:01 am
Yes you can.
December 11th, 2010 at 4:35 am
Nice. Thank you for sharing this with us. its always fun to read good blog like this, keep up the good work.
June 22nd, 2011 at 7:17 pm
thanks
December 17th, 2011 at 7:55 am
This is very wonderful so nice and beautiful information thanks for this post.
December 17th, 2011 at 9:00 am
Its great to see that people are sharing quite profitable information with each other and now we can move our selves to a new era.
December 23rd, 2011 at 10:01 am
Thanks for sharing these useful information! Hope that you will continue doing nice article like this.
December 30th, 2011 at 8:13 am
I must show my affection for your generosity supporting individuals that really need assistance with this particular subject matter. Your very own dedication to passing the message up and down was really interesting and has frequently made others like me to arrive at their objectives. Your entire valuable publication means much a person like me and a whole lot more to my mates. Thanks a lot; from all of us.
January 5th, 2012 at 8:27 am
Your website have very interesting article. I got knowledge from here. Besides that, your blog is so popular among the searchers from search engines. It means yours website is very good.
February 6th, 2012 at 8:10 am
Great a posting. common problems is G. transform their individual views much as well repeatedly.
http://www.obd2center.co.uk/909-bmw-gt1-dis-sss