dean7 Posted October 25, 2016 Share Posted October 25, 2016 Hey guys, I'm currently coding a forum for my site which is just being made for a time waster and to see what I can actually do but in the forum I'm trying to make it so certain forum topics show at the top of the table, for example, Id want Important topics, then Sticky topics the basic topics; Important: Test Sticky: Test Test That sort of format. Regardless of the last reply in the topics I want the forum to always hold that layout. So if there was 3 "Important" topics the topic with the newest reply will be on top but if there is a new reply in the normal topics I want that at the top but below Important and Sticky. I've currently got: if (($Topics->important == "2") AND ($Topics->locked == "2")){ $TitleF = "<strong><u>Important:</u></strong> <a href='Right.php?topicid=$Topics->id' target='frameright'>".check($Topics->topicname)."</a> (Locked)"; }elseif (($Topics->important == "2") AND ($Topics->locked == "1")){ $TitleF = "<strong><u>Important:</u></strong> <a href='Right.php?topicid=$Topics->id' target='frameright'>".check($Topics->topicname)."</a>"; }else{ $TitleF = "<a href='Right.php?topicid=$Topics->id' target='frameright'>".check($Topics->topicname)."</a>"; } Further down my code to try to display the topics how I want I tried this: $Important = $Topics->important; $Sticky = $Topics->sticky; if ($Important == "2"){ $Top = $TitleF; }elseif ($Sticky == "2"){ $Middle = $TitleF; }else{ $Bottom = $TitleF; } echo "".$Top."".$Middle."".$Bottom." </td> </tr>"; All that seems todo is just display the topics but completely wrong. Is there another way I should be going around this? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/302407-making-certain-links-show-at-top-of-page/ Share on other sites More sharing options...
ginerjm Posted October 25, 2016 Share Posted October 25, 2016 (edited) Use a table of "topics" that has a topic number and a sort sequence (integer) column in it. Save your posts with that topic's number in it as well as the posting date of course. Do your query to select the contents you want to display using a join of the two tables and be sure to order the results by topic sort sequence number and posting date. No? Edited October 25, 2016 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/302407-making-certain-links-show-at-top-of-page/#findComment-1538621 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.