tags:

views:

33

answers:

4

I was wondering how can I create a sitemap using PHP & MySQL and is there any sitemap design examples you know of?

A: 

I don't think you need MySQL, is it important for you to use it? Do you have dinamic or static pages? Your question is a little vague. Do you want to make a service that creates sitemaps or just trying to index your own?

Here's a little something to get you started.

Alex
I have dynamic pages. I'm just trying to create my own.
myphp
So why bother when there are dozens free services online that can create a sitemap in minutes?Check this out: http://www.xml-sitemaps.com/
Alex
A: 

This matters on how your site is structured. Are your web pages contained in the mysql Database together with a site structure and get fetched by a PHP script which delivers them to the user, or does your website consist just of static .html files? If the first one, you just have to render the site structure contained in the db to a nice human-readable link-list. If the second, you could, um, stick together a tool which goes through all files and directories in your web folder and makes a linklist out of it, possibly by parsing the site titles from the html files :P

joni
A: 

The question is very vague -- we would need to know a lot more about the rest of your site before you'll get a good answer.

It depends on the structure of your page and what you want included in the map.

If your site is relatively static, then you should save your sitemap as a static page, so it doesn't cause extra processing every time its loaded. But if your site gets updated frequently, then you may need to refresh the map often, so a dynamic one that refreshes every time it is loaded may be better.

If your PHP site has a CMS structure and all your pages are included in the CMS, then it should be relatively simple to run through the database and pull out links to all your pages (depending, of course, on the structure of your CMS).

On the other hand, if your site is not structured in a way that lets you do this, or you want to limit the pages that are shown on the map, then you may find it easier to run a spider across the site and store the results.

There are plenty of existing site map programs already written. I googled php sitemap generator, and got a whole stack of results, of which quite a few look like they could be useful to you, even if only so you can download them to study their source code.

Spudley
A: 

No. You can simply use Sitemap tool to create sitemaps. If you want to merge multiple sitemaps the just load it using load button