Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Create a content management system with PHP and Derby

Use a CMS to submit your site content to Google's index automatically

Tyler Anderson graduated with a degree in computer science from Brigham Young University in 2004 and is currently in his last semester as a master's of science student in computer engineering. In the past, he worked as a database programmer for DPMG.COM, and he is currently an engineer for Stexar Corp., based in Beaverton, Ore.

Summary:  Learn how to build a simple content management system (CMS) that can be used to create, maintain, and submit a sitemap to Google automatically. Page content is managed through a database using PHP and a Web browser. When the system's content changes, the system creates and submits a sitemap to Google, speeding up the process of getting your new and updated content indexed.

Date:  11 Oct 2005
Level:  Intermediate PDF:  A4 and Letter (359 KB | 33 pages)Get Adobe® Reader®

Activity:  3580 views
Comments:  

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).

About this tutorial

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.


Prerequisites

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 CLASSPATH appropriately 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.

1 of 9 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Open source
ArticleID=133641
TutorialTitle=Create a content management system with PHP and Derby
publish-date=10112005
author1-email=tyleranderson5@yahoo.com
author1-email-cc=troy@backstopmedia.com

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.