(Newbie question) Advice on comment system (no db!) design issues

From: Date: Thu, 03 Jun 2004 03:15:41 +0000
Subject: (Newbie question) Advice on comment system (no db!) design issues
Groups: php.general 
Request: Send a blank email to php-general+get-187515@lists.php.net to get a copy of this message
Hi! I am about to write a comment system in PHP, but as i am not any good at PHP i am seeking some advice. This is what i want from the system: * Flexibility! I want to be able to attach it where i want let the user give comments easily. For example comments could be on a blog entry or on a downloadable file, whatever i like it to be. * I will moderate all comments from all "commentpoints" before they are published. * Not use a database. I am wondering what the best approach is? I thought of this: Use an object oriented approach, and have a class called CommentSystem. When i create an instance of the class the "commentpoint" id (some integer/string) is passed and the comments are read into the object. After the object creation i can display all comments using something similar to: aCommantSystem->outputHTML() in my code. The inner datastructure holding the comments should be an array, perhaps multidimensional with different data in each column? When a comment is added using something similar to aCommantSystem->addComment($username,$comment,$date) the array has one element appended to it. Persistent storage of the commentsystem is done through serialize and unserialize and saved to a file with equal name to the specific "commentpoint" id. I will have some way to list all new comments from all commentpoints so that i can moderate them (accept/refuse) before they are to be viewed in public. I haven´t thought of some good way to do this though. Does the above sound like a good solution? Or should i do it in some other way? All feedback would be appreciated!

« previous php.general (#187515) next »