View Full Version : Understanding thread status


darnoldy
18th September 2006, 07:01 PM
Folks-

$thread[statusicon] seems to carry a lot of information:if the thread has new posts, if the thread is locked, if the reader has posted in the thread, and if the thread is "hot."

Are thre variables where I can test each of those conditions individually, or do I have to parse them out of the statusicon value?

Chroder
18th September 2006, 07:24 PM
Don't think so, but it's still a good variable to use. It's not the full path or antyhing, it's just a suffix (_hot, _new, _dot_hot etc).

darnoldy
18th September 2006, 08:08 PM
it's still a good variable to use.Seems like it would be.

Okay, so if I want to determine if a thread has new messages, I can use something like:<if condition="in_array($thread[statusicon],'thread_new','thread_dot_new','thread_lock_new','thread_dot_lock_new')">
Except that this gives an error, so I must have the syntax wrong!

Chroder
19th September 2006, 12:03 AM
Two things: First remember that you need a leading _, so _thread_new, etc. Then, in_array takes a search parameter and an array. You are just passing it a bunch of parameters.

<if condition="in_array($thread[statusicon], array('_thread_new', '_thread_dot_new', '_thread_lock_new', '_thread_dot_lock_new'))">

Floris
19th September 2006, 02:18 AM
I just had a bunch of good ideas that I might use for this. Good stuff this thread. :)

darnoldy
19th September 2006, 05:25 AM
What I am doing with it using the following to set the css class of the whole threadbit, so I can make the threads with unread messages stand out--rather than just relying on the icon.
<if condition="in_array($thread[statusicon],array('_new','_dot_new','_lock_new','_dot_lock_new'))">
<li class="threadbit_new">
<else />
<li class="threadbit_old">
</if>
Note:While I am also changing each listing to an <li> instead of a table row, this technique should also work within a table structure.

Chroder
19th September 2006, 07:04 AM
You can also use $show['gotonewpost'] as a test variable to test for new posts. It's a bit easier to read ;) (Thats the var vB uses to test if to make a thread title bold for unread posts etc)

darnoldy
19th September 2006, 09:16 AM
You can also use $show['gotonewpost'] as a testThat is easier to read. I'm still plowing through the threadbit--there's a lot of stuff there--and I am nervous about using $show[], variables, since some of those seem to be controlled by preference setting.

Disjunto
25th September 2006, 10:10 PM
could you not have created a custom class and used $thread[statusicon] to call it?

darnoldy
26th September 2006, 02:32 AM
could you not have created a custom class and used $thread[statusicon] to call it?that is essentially what I did...

except the statusicon values can be any combination of _hot, _new, _locked, and _dot. Since I am only interested in the presence/absence of the _new component, it is faster to check the statusicon value against an array of acceptable values than to check it against each of the 8 acceptable values in separate if statements.