Jump to content

Help with my forum!


liam1412

Recommended Posts

Whats the best way to go about changing a post status images based on several peices of info!

I have a box for an image that I want to be different based on the current status of a post

For example

I will have these images

Standard Envelope
New Posts (Since last visit)
Hot Topic
Hot topic with new posts (since last visit)
Thread you have posted in
locked topic

and so on........

Can anyone tell me what is the bast way to go about this. I presume it would be some sort of switch stetment. Any hints for a good database setup for this. 

I currently have

[b]forum_topic[/b]
with the fields topic_id, topic, topic_text, topic_username, topic_start_date_time, topic_view, topic_reply

[b]forum_answer[/b]
with the fields ans_topic_id, ans_id, ans_text, ans_username, ans_datetime

Any help with this woud be as always greatly appreciated.

Thanks
Link to comment
https://forums.phpfreaks.com/topic/30333-help-with-my-forum/
Share on other sites

just add a field called something like "topic_status"
with numerical values taken from another table called "status" with fileds somewhat like
[code]
status_id -- status_name  --------  status_img_path
1            Standard Envelope    /somepath/img.gif
2            New Posts                /somepath/img.gif
etc....
[/code]
add the ID to to your main table then when displaying the topics add an if statement or a case statement

[code]
$result = mysql_qeury("select * from status where id='$status");
$res = mysql_fetch_array($result);
switch($status)
{
    case 1:
            $img = $res['status_img_path'];
etc......
[/code]
Link to comment
https://forums.phpfreaks.com/topic/30333-help-with-my-forum/#findComment-139729
Share on other sites

Thats a great help ta.  So the only other problem would be who had posted in what topic.  if one of the images was topic you have posted in - How would you find out what topics the person logged in had posted in.  WOuld I need a seperate table.  Bu t if the site got anything bigger than just afew hundred peole that table would surely way too big and slugish. 
Link to comment
https://forums.phpfreaks.com/topic/30333-help-with-my-forum/#findComment-139738
Share on other sites

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.