View Full Version : Help with my PHP forum AGAIN!!!


liam1412
27-12-2006, 14:28
Sorry to bug you all again but my usual PHP forum hasn't shed much light on this.

My forum is pretty much complete but I want to be able mark topics as sticky so they remain on top and locked so they can be read but not added to. Any ideas on the theory behind this. I also asked about the theory behind a buddy list but not sure if I got an answer and can't find my thread.

Thanks PHP peeps.

esme
27-12-2006, 15:17
you'll need to create a set of flags for each thread to support extra attributes like "sticky" or "locked" or whatever else you want and have your forum code scan for "sticky" threads first then non sticky threads when generating a display, also the posting code will need to check the "locked" attribute before accepting the post, alternatively check when displaying a thread and disable the post button

liam1412
27-12-2006, 15:41
Sorry if im been dumb but how do you mean flags?

Ghozer
27-12-2006, 16:03
add a column field to the topic table for "status" (or whatever you want to call it) as an integer, (0, 1, 2, 3 etc)

Use NULL and 0 for normal, 1 for locked, 2 for sticky, 3 for sticky and postable etc..

then add either a switch or an if that checks the status feild on said topic, and allows posting or not depending on the status indicator in the database, again, you can vary the images and the position based on this using a ORDER BY status DESC AND id ASC etc this will order the posts by status descending then order them by ID ascending blah blah blah..

Dont take this as offence dude, but I cant believe you have written a forum in php and sql, yet you cant figure out how to accomplish probably one of the simplest tasks in this sort of project...

liam1412
27-12-2006, 19:14
I don't take offense at anything mate. I am just struggling my way through and building my forum as I go. I am just learning each individual task as it comes along and haven't come across anything like that before.

probedb
27-12-2006, 20:00
Yep the key to successful software projects is good requirements capture followed by a good database design in your case. Databases can easily end up a mess if not thought about properly.

liam1412
27-12-2006, 20:05
I think I've learned that from this project. But i'm too far on to start again. You live and learn eh? It really is the only way I can learn.