PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun Dec 21, 2014 6:22 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Fri Jul 16, 2010 7:39 am 
Offline
Forum Commoner
User avatar

Joined: Fri Jul 16, 2010 7:17 am
Posts: 43
Location: Apple Valley, California
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: )


Top
 Profile  
 
PostPosted: Sat Jul 17, 2010 12:39 pm 
Offline
Forum Regular
User avatar

Joined: Mon Feb 11, 2008 5:22 am
Posts: 611
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?


Top
 Profile  
 
PostPosted: Wed Jul 28, 2010 10:10 pm 
Offline
Forum Commoner
User avatar

Joined: Fri Jul 16, 2010 7:17 am
Posts: 43
Location: Apple Valley, California
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.


Top
 Profile  
 
PostPosted: Wed Jul 28, 2010 10:35 pm 
Offline
Forum Newbie

Joined: Wed Jul 28, 2010 9:32 pm
Posts: 4
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.


Top
 Profile  
 
PostPosted: Fri Jul 30, 2010 5:18 am 
Offline
Forum Commoner
User avatar

Joined: Fri Jul 16, 2010 7:17 am
Posts: 43
Location: Apple Valley, California
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?


Top
 Profile  
 
PostPosted: Fri Jul 30, 2010 11:57 am 
Offline
Forum Regular
User avatar

Joined: Mon Feb 11, 2008 5:22 am
Posts: 611
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.


Top
 Profile  
 
PostPosted: Fri Jul 30, 2010 5:12 pm 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6434
Location: 53.01N x 112.48W
Moved.

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
PostPosted: Sun Jan 02, 2011 1:37 am 
Offline
Forum Newbie
User avatar

Joined: Sun Jan 02, 2011 12:55 am
Posts: 10
Location: San Jose, CA
This is similar to the forum system I've made :
http://bringtheweb.dyndns.org/~forum/


Top
 Profile  
 
PostPosted: Tue Feb 01, 2011 12:44 am 
Offline
Forum Newbie

Joined: Tue Feb 01, 2011 12:33 am
Posts: 3
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/articles/hierarchical-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.


Top
 Profile  
 
PostPosted: Wed Feb 09, 2011 2:06 am 
Offline
Forum Contributor

Joined: Sat Jul 25, 2009 2:00 am
Posts: 474
Quote:
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group