No announcement yet.

Conditional woes... expert advice needed please...

  • Filter
  • Time
  • Show
Clear All
new posts

  • Conditional woes... expert advice needed please...

    I have recently upgraded to 3.6 and am busy adding in the template mods I made previously. One of which was highlighting certain thread titles in a different colours if they were made in my staff forums.

    Steve Machol helped and what he proposed worked perfectly for vB 3.5 - however, I have been playing with the code in vB3.6 and I can't get it to work.

    The default code in the vB3.6 threadbit template is this:

                <a href="showthread.php?$session[sessionurl]t=$thread[threadid]$thread[highlight]" id="thread_title_$thread[realthreadid]"<if condition="$show['gotonewpost']"> style="font-weight:bold"</if>>$thread[threadtitle]</a>
    ... which makes an unread thread title show as bold.

    I want to add a conditional in there somewhere that makes the thread title show in different colours - regardless of read or unread. So, if unread in forumID=72 the thread title shows in red and bold, and if read the thread title shows just red or if in forumID=62 the thread title shows in green and bold, and if read the thread title shows just green .

    The conditional I think I should use to add style parameters to the code have a syntax of the following:
    <if condition="$show['forumlink'] AND in_array($thread[forumid], array(62))">style="color: #ff0000"</if>
    <if condition="$show['forumlink'] AND in_array($thread[forumid], array(72))">style="color: #00ff00"</if>
    But I can't seem to add this code into the above code and get it to work. I get the different colours showing for threads in different forums, but then I lose the bold if they are unread!!

    Any help?

  • #2
    Try this code:
    <a href="showthread.php?$session[sessionurl]t=$thread[threadid]$thread[highlight]" id="thread_title_$thread[realthreadid]"<if condition="$show['gotonewpost']"> style="font-weight:bold;
    <if condition="in_array($thread[forumid], array(62))">color: #ff0000;</if>
    <if condition="in_array($thread[forumid], array(72))">color: #00ff00;</if>
    "<else />
    <if condition="in_array($thread[forumid], array(62))">style="color: #ff0000;"</if>
    <if condition="in_array($thread[forumid], array(72))">style="color: #00ff00;"</if></if>>$thread[threadtitle]</a>
    Best Regards
    Colin Frei

    Please don't contact me per PM.


    • #3
      Wehey - thanks Colin... why are you not having a beer then


      • #4
        I wonder if anyone can advise me please if there is an equivalent code mod I could make for vB4.


        • #5
          Originally posted by TheMusicMan View Post
          I wonder if anyone can advise me please if there is an equivalent code mod I could make for vB4.
          The right place to ask that would be in the vB4 forums.

          Please don't PM or VM me for support - I only help out in the threads.
          vBulletin Manual & vBulletin 4.0 Code Documentation (API)
          Want help modifying your vbulletin forum? Head on over to
          If I post CSS and you don't know where it goes, throw it into the additional.css template.

          W3Schools &lt;- awesome site for html/css help


          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.