Chapter 10. News/Blog System

The word blog comes from a shortening of web log and since its inception, it has become synonymous with any type of online journal. A blogger — someone who authors the blog — posts his or her ideas or experiences and invites readers to leave comments starting a dialog around a certain topic. Few of us predicted the popularity and impact blogs would have on the web; writing blogs is an activity that has swept the Web by storm so much that few of us can recall what the Web was like before they appeared. You can find all sorts of blogs ranging from "a day in the life" type recounts to pundit comments which become the impetus for political action.

With its comment feature disabled, a blog is suitable as a news system. Posts can let visitors know what's going on behind the scenes at the web site or summarize changes that have recently been made to the site's content.

In this chapter, you will build a basic blog system. It will have an administrative page to allow the blog author to create new, modify and delete existing posts. A JavaScript-powered rich text edit control will be integrated so the author can easily format the entry. Visitors, however, need only be allowed to post plain text comments (although if you wanted you could just as easily allow them to format comments using BBCode mark up as discussed in Chapter 2). The system should also automatically generate an RSS feed showing the most recent posts so visitors can subscribe to the blog.

Get PHP and MySQL®: Create-Modify-Reuse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.