O'Reilly logo

Wicked Cool PHP by Brian Ward, William Steinmetz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

#76: A Blogging System

Blogs are common because they're very easy to write—all you really need is a system to keep track of dates and content. The basic blog that appears here includes tools for adding entries, adding comments, and viewing entries. The system stores entries and comments in a MySQL database and uses Smarty for display templates.

Here is the main table for blog entries, originally named blog_entries:

CREATE TABLE 'blog_entries' (
'ID' INT NOT NULL AUTO_INCREMENT ,
'title' VARCHAR( 120 ) NOT NULL ,
'content' TEXT NOT NULL ,
'teaser' TINYTEXT NOT NULL ,
'entry_time' DATETIME NOT NULL ,
'category' VARCHAR( 12 ) NOT NULL ,
PRIMARY KEY ( 'ID' )
) TYPE = MYISAM ;

Most of these fields are self explanatory. teaser is a snippet of the entry ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required