Live data from Hacker News

I'm building a HN clone in PHP, and I need help

news.ycombinator.com

1–10 of 12 posts

I'm building a HN clone in PHP, and I need help

#1
Hi, well as the title says, I'm programming a HN clone. I choose PHP because is more simple to find a hosting which provides us PHP.

And I have some questions, the first is about HN comments, in its structure a comment is an item. I'm using MySQL, and my table 'items' can store comments too. My question is: HN has a limit deep in comments? Because is complicate get comments using recursivity.

That's the reason because I prefer use SQL and a limit of comments.

I have no time to finish quickly this project, but I'll try to do it fast.

There are lots of broken links, only works the login/signup and an item views.

URL: http://news.sourcezilla.com

Thanks in advance.

Re: I'm building a HN clone in PHP, and I need help

#3
post #2

You need to do self joins. You can have one comments table but there can be parent_id for each comment. http://stackoverflow.com/questions/3362038/what-is-self-join... this might help.

Yes, my table structure has a parent_id field. The problem is that I need know the depth, or use recursivity to get all parents.

Using hierarchy and recursivity like this: http://stackoverflow.com/questions/4216875/php-reorder-array...

Re: I'm building a HN clone in PHP, and I need help

#4
post #3
post #2

You need to do self joins. You can have one comments table but there can be parent_id for each comment. http://stackoverflow.com/questions/3362038/what-is-self-join... this might help.

Yes, my table structure has a parent_id field. The problem is that I need know the depth, or use recursivity to get all parents. Using hierarchy and recursivity like this: http://stackoverflow.com/questions/4216875/php-reorder-array...

http://www.jongales.com/blog/2009/01/27/php-class-for-thread...

see if that helps

Re: I'm building a HN clone in PHP, and I need help

#5
post #4
post #3

Earlier quoted context omitted.

Yes, my table structure has a parent_id field. The problem is that I need know the depth, or use recursivity to get all parents. Using hierarchy and recursivity like this: http://stackoverflow.com/questions/4216875/php-reorder-array...

http://www.jongales.com/blog/2009/01/27/php-class-for-thread... see if that helps

I'm going to check out. Thanks!

Re: I'm building a HN clone in PHP, and I need help

#9
post #6

Just out of curiosity, is hacker news built in similar fashion to reddit? Considering reddit is a YC invested company. reddit is open source so...

Hi dosh, I don't think that HN is build or is inspired in Reddit code/design. Both of them are open source, but Reddit is build in Python and HN in Lisp.
Post reply on HN