Jump to content

Recommended Posts

hi,

I have a post icon system on my news page that has these options:

important, new, old, popular, and locked

now the problem comes with the important one.

i want it to alway be the important icon when the news is important, nothing else. but I do not know how to do it.

if you want to see how im doing it now reply back and I'll pop that code here for you.

thanks.
Link to comment
https://forums.phpfreaks.com/topic/4090-need-help-with-icon-system-i-made/
Share on other sites

ok then here how im doing it:

[code]//decide on icon.
if ($row['important'] == "yes"){
$icon = "$template_path/images/important.gif";
}elseif ($row['Locked'] == 1){
$icon = "$template_path/images/locked_topic.gif";
}elseif ($row['Type'] == "Poll"){
$icon = "$template_path/images/poll.gif";
}elseif ($read_status == "new"){
$icon = "$template_path/images/new.gif";
}elseif ($read_status == "old"){
$icon = "$template_path/images/old.gif";
}elseif ($reply_num >= 10){
$icon = "$template_path/images/hottopic.gif";
}[/code]

setting each as a if statement only made it worse in case you plan on saying that.
[code]
if ($row['important'] == "yes"){
$icon = "$template_path/images/important.gif";
}

if ($row['Locked'] == 1){
$icon = "$template_path/images/locked_topic.gif";
}elseif ($row['Type'] == "Poll"){
$icon = "$template_path/images/poll.gif";
}elseif ($read_status == "new"){
$icon = "$template_path/images/new.gif";
}elseif ($read_status == "old"){
$icon = "$template_path/images/old.gif";
}elseif ($reply_num >= 10){
$icon = "$template_path/images/hottopic.gif";
}
[/code]

Not tested
nope that kills off the important icon from even working.

isnt there a way to make a item important no matter what else the item could have.

like phpbb for example, no matter what if its new/old, locked or has a poll that icon stays the same, thats what i want.
Can you explain exactly what it is you want the script to do? Does it only display one icon? Can it display multiple icons? If so, under what circumstances?

Maybe what you want is this:
[code]if ($row['important'] == "yes") {
    $icon = "$template_path/images/important.gif";
} else {

    if ($row['Locked'] == 1) {
        $icon = "$template_path/images/locked_topic.gif";
    } elseif ($row['Type'] == "Poll") {
        $icon = "$template_path/images/poll.gif";
    } elseif ($read_status == "new") {
        $icon = "$template_path/images/new.gif";
    } elseif ($read_status == "old") {
        $icon = "$template_path/images/old.gif";
    } elseif ($reply_num >= 10) {
        $icon = "$template_path/images/hottopic.gif";
    }
}[/code]
heres a map of how i want it:

if post is important and also either new,old, a poll, or locked the icon is set to important

otherwise:

new-new icon
old-old icon
ect

like i said before like how phpbb or ipb. if the user marks the post as important it will keep the important icon no matter what.

so in general yes I want only one icon to show. currently if the topic is important but i locked it from getting comments the lock icon takes over or if i make it a poll the poll take over.

i know theres a way to do this, I just cant figure it out.

I hope you all understand what i'm trying to say.

Andyb,

i tried your method and it seems to do what I want :)

so thanks for that.
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.