Can a sitemap file be php?

Travis

New Member
I'm fairly new to search engine optimization. But, I've heard that sitemaps can drastically improve SEO. I know that the sitemap file has to be in xml format. But, the content of my site is very dynamic. That being said, I need to query the DB to find out how the content has changed as time goes on. My code is as follows:\[code\]<?phprequire_once("functions.php");connect();// Query the DB to get the past season MLB teams $query = mysql_query("SELECT * FROM past_season_team_articles") or die(mysql_error());$count = mysql_num_rows($query);$i = 0;while($row = mysql_fetch_assoc($query)) { $team[$i] = $row['team']; $year[$i] = $row['year']; $i++;}?><?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><?php // Loop thru the array and echo out the MLB teamsfor($i=0;$i<$count;$i++){?><url> <loc>http://www.sportannica.com/teams.php?team=<?php echo $team[$i]; ?>&year=<? php echo $year[$i]; ?></loc> <changefreq>weekly</changefreq> <priority>0.8</priority></url><?php}?></urlset>\[/code\]
 
Back
Top