Analysis: Messageboard v1.1

Take a look over the messageboard system so far - try and give every script a use, and see what things you pick up on that could be changed. Yes, the design is quite nasty right now, but that is fairly academic - this is not a book about pretty HTML design! We have a fully working messageboard system now, so the goal is to make it better and/or easier to use. We're not talking major changes at this point (that comes later, in v2), just simple tweaks to make it an overall better system.

Here is the list I compiled:

  1. There is no way to get back to index.php from mbindex.php, no way to get back to mbindex.php from read.php, post.php, or search.php, and no cancel button when replying to, editing, or deleting posts.

  2. When in mbindex.php, it does not say the name of the messageboard so you do not know where you are

  3. It would be good to be able to search just one messageboard

  4. It would be good to store a "read count" for messages - the number of times each message was read.

  5. The messageboards all look the same; it would be good if some customisation was possible.

  6. On index.php, it would be good if each messageboard could have a short textual description as well as a thread count and total post count.

As you can see, the changes above are all very simple, and should require no more than about five seconds work each to implement - perfect for a 0.1 version number change.

Putting those changes into practice is largely down to the PHP scripts, although change 5 and the first part of change 6 requires adding some extra fields into the mblist table, and change 4 requires adding a field into the mbmsgs table.

Now, what shall we allow messageboard owners to customise? I think perhaps the background colour should be customisable, as should the text colour, and also the hyperlink colour. The easiest way to implement this is to simply add three new fields to the mblist table - one for each colour. However, the easiest way is not always the best way, because this plan would mean that every other aspect we wanted to allow people to customise in the future would require more and more fields to be added to the database.

Instead, mostly to help you revise on your learning but perhaps partially also for the coolness factor, we're going to modify our system to accept a custom Cascading Stylesheets (CSS) file, and use that to handle the design of each messageboard. This means we need to modify create.php to allow people to select a CSS file from their hard drive to upload for use on their messageboard - this means we can simply add CSS names to our scripts and let people define which they want to change in their CSS file.

In the same way that this is not a book on HTML, neither is this a book on CSS - I don't have time to discuss here how CSS works, what all the different attributes you can use are, etc, etc. Having said that, I will try to keep it fairly simple and explain everything the script uses - see the Further Reading section at the end of this chapter for references on CSS.

To give each message its own read counter we simply need to add a ReadCount field to mbmsgs and give it a default value of 0. Then, in read.php, we need to increment ReadCount by 1 for the current message. To give each messageboard its own description we need to add a text box to create.php to allow people to enter the description, and add the corresponding character field to mblist.

 

Next chapter: Making Messageboard v1.1 >>

Previous chapter: Development

Jump to:

 

Home: Table of Contents

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar