Building a Weblog | WebReference

Building a Weblog


[next]

Building a Weblog

By Jono Bacon

One of the most talked about Internet phenomenon in recent times is that of the Weblog (often shorted to blog). The concept of a blog—and the subsequent art of blogging—is that you provide your own online diary or journal in which you can scribe your thoughts for the world to see. The actual content that you pour into your blog is completely up to you, and the blog can be as formal, or informal, as you like. If you want to tell the world that your milk went bad and you need to pick up some from the store, a blog is where you write all about it.

The blog-reading public is not just obsessed with milk-longevity-related shenanigans, though. Although typically used as a vehicle to communicate thoughts online, blogs have also become a primary means by which various people connected to a hobby or project share what they are working on. This has been particularly popular with Open Source developers who use their blogs to give their readers a sneak peak of what's to come in the software they hack.

Although the basic function of a blog is to store a series of blog posts (often called entries), many blogs also include other features:

  • Commenting. Readers of the blog can often leave comments. This can add real value to a blog, and conversations often strike up over varying subjects.
  • Categorization. Blogs are often separated into different categories. This gives the blog author the ability to file entries into a specific section. This also allows readers to read only the category that interests them.
  • Archives. Most blogs have some means of archiving and accessing previous entries. With blogs becoming as relevant a medium as "normal" Web sites, being able to access earlier entries is important.

In this project, you will build a blog that incorporates all of the preceding features. Aren't you lucky?

Project Overview: Blogtastic Use Case

The blog application created in this chapter is rather niftily titled Blogtastic. To get an overview of how to build the blog, here is a simple use case that demonstrates how typical users would interact with the application. Use cases are very handy for helping to visualize exactly how different interactions and content should be presented to users. The following is a synopsis of the use case for the Blogtastic application:

John visits Pauline's blog and, naturally, wants to see Pauline's latest entry. John is interested in reading the blog entry but would also like to see if any comments have been posted in response to the entry. If the blog entry has comments, the names of the commenters are added to the bottom of the blog, so John can see who posted each comment.

To access the blog and any corresponding comments, John clicks the title of the blog entry, and that specific entry (with comments) is displayed. In case John wants to leave a comment, a form for him to express his views is conveniently available on the same page. John fills outs the form and clicks the Submit button, after which the page is reloaded with John's comment added. John then whiles away the afternoon perusing through older blog entries in the archived entries page.

Later that day, Pauline decides she wants to add a new blog entry. Pauline visits a special page on the Web site where she can log in. As the blog's author, some additional options are made available only to her. Pauline can add a new blog entry to a specific category, or she can even add a new category. Pauline adds a new entry and then realizes she made a mistake. Fortunately, a special Edit button that she— and only she—can see displays on the page. Pauline uses this button to correct her mistake and avoid looking silly in front of John. Pauline secretly thinks she is better than John.

This is a typical example of a blog, and in this project, you will pour all of the preceding functionality into Blogtastic to match this use case.

NOTE

Take Your Time

Because this is the first database-driven project in this book, progress through the chapter at a pace that is comfortable to you. If you come across any concepts you don't understand, take a moment to stop, visit Google, and do some research to clear up the misunderstanding before you continue. When learning a new technology, never plough on if you don't understand the concepts; you will only dig a bigger hole to fall into.



[next]

URL: