Site Administration Page 3 - Talk To Me! |
This is a good time for you to download the source code, so that you can refer to it throughout this tutorial (you will need a Web server capable of running PHP and a mySQL database in order to run the application). comments.zip The first order of business is to design a table that will hold the comments entered by the user. After much thought, discussion and stale pizza, here is the structure we finally decided on.
We decided that each post would display the author's name, email address and date/time on which it was posted. Our original table did not include a field for the subject; this was added in order to make it easier for readers to quickly divine the nature of the post, and thereby decide whether or not it was worth reviewing. In this structure, each post is identified by a number. This number, combined with the "replytopost" attribute, comes in very useful when constructing a threaded list of posts (as you'll see a little further down). The "replytopost" attribute identifies the post one level up in the discussion "tree", and thereby makes is easier to relate one post to another when constructing the threaded tree structure. A "replytopost" value of 0 indicates that there are no posts above this one in the tree...in other words, that this is a new "branch" of the discussion tree. This article copyright Melonfire 2001. All rights reserved.
blog comments powered by Disqus |