Hi,
I have a sitemap and have decided to create an automated sitemap.
I just wanted to ask would the way i am going to do it be ok.
I was going to create a table let say called `sitemap` have a column in the table called `url`. Basically i would create a section in my admin so i can manually add/delete/edit if i wanted to.
then i was going to create a sitemap.xml file
in that file i was going to create a simple php script that querys the database and using mysql_fetch_array to get everything from the url column and echo it out something like the below, i just created the below script quickly as an example:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<?php
// my global file will go here
sql_con(); // function to connect to db in global file
$query = mysql_query("SELECT * FROM `sitemap`");
$fetch_data = mysql_fetch_array($query);
echo "<url>";
echo "<loc>" . $fetch_data['url'] . "</loc>";
echo "<changefreq>always</changefreq>";
echo "</url>";
?>
</urlset>
Would something like this work?
If it does i will be adjusting some of my scripts that i have to insert url whilst for example submitting a blog post so i wont have to manually add to db, but before i go anyfurther i wanted to maker sure would something like the above work.
Thanks
Genieuk