Free Software PHP Comment System

Looking for volunteers to join your project? Need help with a script but can't afford to pay? Want to offer your services as a volunteer to build up your portfolio? This is the place for you...

Moderator: General Moderators

Post Reply
User avatar
TildeHash
Forum Commoner
Posts: 43
Joined: Fri Jul 16, 2010 7:17 am
Location: Apple Valley, California

Free Software PHP Comment System

Post by TildeHash »

Hello,

I am currently developing a Free Software comment system (AGPL) in PHP. I'd love to have some help if anyone is willing or interested. It doesn't currently have replies, which is a feature I'd love to have working. And I am concerned about my methods, particularly because it relies on writing the comments to .txt files, which requires a directory be readable, writable, and executable by everyone.

You can view my comment system here: http://www.tildehash.com/comments.html
And the source code here: http://www.tildehash.com/comments.php?source

(I posted this on another PHP forum, but they don't like projects... they deleted my post :cry: )
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: Free Software PHP Comment System

Post by greyhoundcode »

Might be a good one to stick in the Volunteer Work section.

Is there a reason you are using .txt files rather than a database?
User avatar
TildeHash
Forum Commoner
Posts: 43
Joined: Fri Jul 16, 2010 7:17 am
Location: Apple Valley, California

Re: Free Software PHP Comment System

Post by TildeHash »

greyhoundcode wrote:Might be a good one to stick in the Volunteer Work section.
Quite true.
greyhoundcode wrote:Is there a reason you are using .txt files rather than a database?
Yes. TXT files are separate from each other, if I add or delete one I don't have to worry about messing up the structure of a database.
boredboy5
Forum Newbie
Posts: 4
Joined: Wed Jul 28, 2010 9:32 pm

Re: Free Software PHP Comment System

Post by boredboy5 »

Why would you need to worry about ruining the structure of the database? You could just create separate tables; like, basically each table is just a text file.
User avatar
TildeHash
Forum Commoner
Posts: 43
Joined: Fri Jul 16, 2010 7:17 am
Location: Apple Valley, California

Re: Free Software PHP Comment System

Post by TildeHash »

boredboy5 wrote:Why would you need to worry about ruining the structure of the database? You could just create separate tables; like, basically each table is just a text file.
Oh. Well, the last thing I remember about using a database is if you mess up and leave a newline, it won't phrase correctly. Would a database be easier / faster for PHP execution than individual files?
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: Free Software PHP Comment System

Post by greyhoundcode »

Would it be easier/faster? Depends on a number of variables really.

My personal rule of thumb is to do what I feel most comfortable with. For me, a database "feels" like the best fit here. Plus, if you are tying responses to user accounts, then it affords some additional security benefits.

Also, as you say yourself:
TildeHash wrote:I am concerned about my methods, particularly because it relies on writing the comments to .txt files, which requires a directory be readable, writable, and executable by everyone.
Depending on how far you intend taking this project, might you consider implementing different drivers? That way you could have (perhaps) a flat/file (XML based?) driver as well as a database driver (which might itself utilise a SQLite driver, MySQL driver etc).

Just some thoughts.

But, basically, I for one would utilise a database.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Free Software PHP Comment System

Post by pickle »

Moved.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
prefer32bits
Forum Newbie
Posts: 10
Joined: Sat Jan 01, 2011 11:55 pm
Location: San Jose, CA

Re: Free Software PHP Comment System

Post by prefer32bits »

This is similar to the forum system I've made :
http://bringtheweb.dyndns.org/~forum/
wastedgod
Forum Newbie
Posts: 3
Joined: Mon Jan 31, 2011 11:33 pm

Re: Free Software PHP Comment System

Post by wastedgod »

Just a couple quick suggestions. If you switch to a relational db such as mysql I would suggest using a nested set model for the comments and replies. Mysql's site has a good artical at http://dev.mysql.com/tech-resources/art ... -data.html on how to implement one. This will allow you to place your comments and replies in a tree structure. Also can't recommend a template engine like Smarty enough. Takes only a few mins to get a "good enough" understanding and will save you hours when doing UI design and debugging.
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: Free Software PHP Comment System

Post by cpetercarter »

Also can't recommend a template engine like Smarty enough. Takes only a few mins to get a "good enough" understanding and will save you hours when doing UI design and debugging.
+1
Post Reply