PHP Simple "Add a Comment" system without MySQL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
laD__
Forum Newbie
Posts: 1
Joined: Mon Sep 29, 2003 6:14 am

PHP Simple "Add a Comment" system without MySQL

Post by laD__ »

hi guys,
or i need a really particular script or i dont know more how do a search because i searched for something like this on many site (evilwalrus.com, hotscripts.com, html.it, google.com.. ) but i didnt find a solution yet.
so i decided to find a forum where post my problem and bug its users for a while :)

my problem is the following one.
i work with HTML since 1997 i think but just 20 days ago i decided (finally) to turn to a language for building dynamic website. i selected PHP due its portable, flexible and open source.. and easy to use (as othe rpeople say!).

now, i mantain a little site where i upload some songs by me in .ogg format. i mantain it on a free web space that support PHP but not mysql, so i have some limitations.

anyway i finished the counter of downloads and im workin on the forum but i have no idea about how do the comment system.

yeah, i need something that permit to the user to post comment about each song.

imagine: a link "add a comment". when you click on it, it appears a popup with a simple form (Nick/website/comment) that saves the comments
on .txt and show them back on the same popup with auto refresh thing.

i have to save comments on txt due no mysql support.

is this possible? can someone provide me a script or some suggests or some other thingies? thanx a lot for help/patience.

laD__
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

The way i would go about achieving what you have described is not store the comments in a text file, but to write the comments to the actual HTML document.
This way, you won't be using uneccessary processing time having to read the comments.txt, which i presume could get quite big.

Basically, create the pages that will have comments and produce a form for the user to add a comment.

In the page ad a tag, something like {comment_here}

When the user submits this comment (along with a unique ID in a hidden form field), a script will open the correct HTML page (based on the unique ID), replace the {comment_here} tag with the new comment. After the comment add another {comment_here} tag so the next time someone ads a comment, it will be added to the end.

The advantage of doing it by this method is the only processing that will need to be done will be when a user add a comment, and not everytime someone wants to view the comments!

I probably didn't explain all that very well, so if you have any questions, don't hesitate to ask.
Post Reply