Jump to content

Making certain links show at top of page


dean7

Recommended Posts

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!
Link to comment
Share on other sites

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 by ginerjm
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.