Included with your copy of A Wee Tiny Blog is a directory containing several .php files, a css file, and a couple of images. These are examples of some of the things you can do with A Wee Tiny Blog. Each file is heavily commented so you can follow along as you read the code. While there are only ten scripts, it can be a lot to take in at once. Below is some advice on setting things up, an overview of each script, and what you can expect to find in them.
In order to use the examples, you'll need to do a few things. Firstly,
install A Wee Tiny Blog on your website using the "Generate and Seed table" option.
Next, open
dbaccess.php with your favorite code editor. Edit the variables here to match your MySQL setup, and then save the file. Upload everything to a convenient place on your server, placing the
aweetinyblog.php file in the same directory as the other scripts.
Once all of the files are in place, everything should be ready and working. To check, visit
pageofentries.php in your browser; if everything is set up properly, then you won't see any error messages.
Each of the eleven files in the example directory play a fixed role in running a typical blogging website. They each do exactly one thing, and do it well. Here's a simple run down of the pages and their associated function.
blog.css
This is just some CSS to control the appearance of the other pages. There's no PHP code here.
dbaccess.php
This file holds the information needed to access your MySQL server. While this works, it's not as secure as it could be -- for a live site, never place your sensitive log in information in global variables!
template.php
PHP can do many things, and one of the more useful tricks is to provide a way to control how a website looks with a single file. Thanks to this one file, everything is kept very uniform throughout the examples.
pageofentries.php
This script displays the last ten entries in reverse chronological order, which is a typical front page for blog. There are also navigation options over on the left, allowing you to browse the entries as pages with ten entries each.
singleentry.php
Sometimes people will want to view a specific entry. Normally, you can get to this page by clicking on the subject line of a post on another page, but you can also browse from post to post using the links on the left.
summary.php
People visiting a long running blog will want a way to skim through large numbers of posts. Perhaps because they're trying to locate something they saw a while ago or they just want to skip to the juicy bits. Archive pages are the solution for this, and this example shows how to make one by displaying only the time and subject line of every post made during a given year.
rss_feed.php
RSS feeds are special XML documents that people can use to keep tabs on their favorite websites. While you need a special program to monitor your feeds for you, creating one from your recent posts is incredibly easy. View the code for this file to find out how to assemble a proper RSS feed using A Wee Tiny Blog and a little PHP.
cp_menu.php
This is the first page of the control panel examples. From here you can choose to create a new entry or edit an old one.
cp_edit.php
Here you'll find the HTML form that allows you to edit your entries. There is also a button in the lower right that allows you to delete an entry if you don't want it anymore.
cp_save.php
When you've clicked the submit button on cp_edit.php's form, this is the page that is called on to do the hard work of actually saving your post.
cp_delete.php
The delete button on cp_edit.php sends the request here, where the post is actually removed from the database.