Page 1 of 1

Organizing a forum board

Posted: Thu Dec 06, 2007 1:45 am
by arpowers
Hey guys,

I'm creating a discussion board (forum) on my site...

what is the best way of querying and ordering the posts (to sort by order of with last post per thread)

since I'm using two tables, it seem a little counter-intuitive (or at least hard to do elegantly)

Andrew

Posted: Thu Dec 06, 2007 2:03 am
by alex.barylski
Heh???

Threaded message boards are best...easiest to follow anyways...but they usually come with the price of recursion...although it's possible to implement using loops...

One table for the subjects, shown as threaded indented entries based on timestamp or PKID or something. Use AJAX to load the body or if not available refresh the screen and show only the selected topic. This will save tons of bandwidth.

So...

1 table to hold message subjects
1 table to hold the contents of each message

That is about the easiest implementation I can think of...for a very basic forum...

p.s-Why does everyone want to build forums??? There are so many options (open source) and essentially they all offer the same thing...not like CMS where the diversity is so great that it often makes sense to roll your own... :P

Giver!!!

Posted: Thu Dec 06, 2007 3:44 am
by phpBuddy
Hockey wrote:That is about the easiest implementation I can think of...for a very basic forum...
p.s Why does everyone want to build forums???
There are so many options (open source) ......
I agree!
There are so many variations, from very basic to more feature rich free open source forum software.
There is no need to design your own code.
There are also sites with an overview, demos and great help when decide what forum suits you:

:!: http://www.opensourcecms.com/index.php ---- Forums DEMO in left menu
:!: http://www.forummatrix.org/ ---- Choice Wizard

This is a very popular and very lightweight basic forum:
http://www.forummatrix.org/show/Vanilla

( ... but, Vanilla only 2 databases supported: MySql and Postgres. Not for example Sqlite )

My main, most important criteria for selecting a Forum or CMS software
is the supported database option I will have at my hands.

=====================================================

By the way, phpBB 3 is very promising!
I have installed most Release Candidate versions, a few days ago came phpBB 3.0 RC8
I never really liked phpBB 2.
Among the new features of phpBB 3 is: Sqlite and other database support now
Download and Install phpBB 3.0 RC8:
http://www.phpbb.com/downloads/
:)

Posted: Fri Dec 07, 2007 12:25 am
by arpowers
Thanks for the replies..

the reason I'm building my own forum is because
it is deeply integrated into my application...
and if I used someone else's i would end up spending just as much time
tweaking it...

Posted: Fri Dec 07, 2007 12:34 am
by s.dot
You learn a freaking crapload (excuse my language) from building your own forums/message boards. I know I did. And the customization and integration into my existing applications was seemless (because I coded it all). I'm all for you building your own forums! It's one of the best things I've ever did.

Here's how you order topics by their last post (as if you were viewing forums.devnetwork.net/forums.php?f=6 (or something like that))

Code: Select all

SELECT `fields`, `you`, `need` FROM `forumthreads` ORDER BY `time_of_last_reply` DESC
`time_of_last_reply` should be a unix timestamp (or you can use mysql date conversions in your query)

Of course, this may not be suitable for your database structure. If you could post the structure of those two tables, it would help us answer you better.

Choose the Right Board

Posted: Fri Dec 07, 2007 12:36 am
by s.dot
Seems like I'm moving a lot of posts concerning queries only to the Databases forum. I think this is what I should do. If this post involves PHP Code, too (which at this point I don't think it does), please inform me and I'll move it back to the php code forum.

Moved to databases:
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:1. Select the correct board for your query. Take some time to read the guidelines in the sticky topic.

Posted: Fri Dec 07, 2007 6:34 am
by phpBuddy
scottayy wrote:You learn a freaking crapload (excuse my language) from building your own forums/message boards. I know I did. And the customization and integration into my existing applications was seemless (because I coded it all). I'm all for you building your own forums! It's one of the best things I've ever did.
A guestbook or a weblog
is in fact not much different script, than a Forum.
A guestbook/weblog has got most of all functions needed.
Post, edit, delete posts/articles and display them as a Thread, with pagination.

The difference is about the only that a forum uses several threads.
So we need to 'multiply' the guestbook/weblog script.
And add the possibility to access different threads/topics.