Jump to content

Help within displaying a topic status symbol dependant on how many posts etc


liam1412

Recommended Posts

Within my forum I have column (status) that displays a picture dependent on the status of the topic

for example
less than 50 posts diplay pic 1
more than 50 posts diplay pic 2
locked post - display pic 3
topic you have posted in - display pic 4
hot topic you have posted in display pic 5

etc etc

How would I go about doing this. ???

The main one I think I would struggle with is the topics you have posted in as I can't figure out what database structure would be needed for this. But advise on the whole thing would help;D

Thanks

Edit - On this forum it is the normal picture for a thread with a little smiley face next to it - down the left hand side of the main forum page.

Simple way is to create a switch, or you can use a function or class.  I will give an example:

[code]switch ($variable) {
case ($variable < 50):
$img[0] = "img/img1.jpg";
break;
case ($variable > 50):
$img[0] = "img/img2.jpg";
break;
default:
$img[0] = "img/imgdefault.jpg";
break;
}[/code]
Sorry mate.  I don't make much sense Lol

On forums you have a post status symbol at the side

This has a switch between 5 pics

One of thos pics will be say a thread you have posted in.  What would be the databse structure for storing every thread that somone has posted in> Surely that database would just be so slow if the site got big.

Does this help?!?!
One thing with database design is to try and break things down as much as possible.  There is really not much you can do to simplify a thread setup except use a thread table by itself and a categories table by itself.  Have the category id the foreign key in your thread table then when you click on a category you can speed up the search by using the category id so it will only grab threads related to that category.  Hopefully this helps, best advice to you is to download a couple of opensource forums and inspect for yourself, that's the most efficient way of learning.  :P

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.