Before you start
This tutorial is for those interested in automating the process of creating, editing, and submitting a Google sitemap using a CMS with PHP. This tutorial assumes familiarity with basic PHP concepts, including loops and if-then statements, form handling, accessing a database, and the Document Object Model (DOM). You can learn about these by reading the "Learning PHP" series. Many other articles and tutorials are available, as well (see Resources).
In this tutorial, you will build a CMS that will house the content of your Web site. It will also allow you to add and edit pages through a form, and save them in the database by clicking a button. On the main CMS control page, there will be an option to view, edit, and delete each page in your Web site, add a new page, or submit them all to Google using a beta mechanism called Google Sitemaps (see Resources).
A Google sitemap is an easy and efficient way to maintain information about the content on your Web site. A sitemap contains information like how often content changes, the date of the last modification, and the priority you place on a page that indicates to Google how important it is that the new content get into Google's index quickly.
Normally, a Google sitemap is created and maintained manually in an XML document. The sitemap is also manually submitted to Google. The CMS you will build in this tutorial will automatically create and maintain the sitemap, and on changes to content, the CMS will automatically submit the sitemap to Google for swift indexing.
To follow along, install and test the following tools (see Resources for help and links to documentation):
- Web Server
- It doesn't really matter which Web server you use, or whether you use Linux® or Windows®. Download Apache V2.X.
- PHP
- PHP V4 and V5 are in use at the time of this writing, but we recommend V5 for the DOM sections in this tutorial.
- Database
- The content management system of this tutorial relies on a database. This tutorial uses Derby, which is open source. Download Derby V10.1, the IBM DB2® JDBC Universal Driver, and the DB2 run-time client from IBM. Make sure that you have set your
CLASSPATHappropriately by following the instructions on each page. You can follow the Linux or Windows instructions for installing and downloading the DB2 run-time client. - Cloudscape
- This database could also be used for this tutorial. The internals of Cloudscape are the same as Derby. However, the DB2 JDBC Universal Driver and other things are packaged into Cloudscape, and it is supported by IBM. Although Derby is used in this tutorial, you can download Cloudscape V10.1 and the DB2 run-time client from IBM.
- Java ™
- Derby requires Java technology. In working on a Linux box running Red Hat Fedora Core, I found that gcj provided in the distribution was insufficient.




