Hudzilla.org - the homepage of Paul Hudson
Contents > Practical PHP > Creating a messageboard Wish List | Report Bug | About Me ]

22.3.3     Analysis: Messageboard v1.1

This is NOT the latest copy of this book; click here for the latest version.

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.





<< 22.3.2 Development   22.3.4 Making Messageboard v1.1 >>
Table of Contents
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.



My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!



Top-right shadow
 
Bottom-left shadow Bottom shadow

Comments from other readers
hidden_flame_910@hotmail.com - 07 Sep 2008

Hi, I'm relatively new to all this php stuff, and don't know how to include this in a working web page. I've tried opening these php files with internet explorer, but nothing happened, what can I do to make it work?



Add comment
Please note that by posting a comment here you are committing it to the public domain. This is important so that others can make use of your code themselves, and also so that I can incorporate helpful notes directly into the main text. Comments are limited to 2000 characters in length.

If you are reporting an error in the content, please tell me directly.

Your name/email address:
Your comment:
 
Now, in order to verify that you're a real person, please answer this simple question: what is five plus eight?
The answer is:
(please write in
numbers, eg 19)


Top-right shadow
 
Bottom-left shadow Bottom shadow