MyBB Hacks

Full Version: Some help with this if statement is appreciated
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have just updated mybb and lost some templates so i have to try and redo what i did, since i cant find my backup Frown

so logic wise it would be,

if forum id = "7" then > do this
if forum id = "8" then > do this
Else > do this

i cant rememeber how the hell i did it before Frown can anyone help

i did find this using google

<if in_array($thread['fid'], array(1,4,22)) then>
code
<else>
code
</if>

But it does not work the way i need, as i need each forum id to do something else, and then have the single else statement at the bottom.

And in case your wondering why, i have a single forum forum, with a hidden subscriber forum and a hidden staff forum, and i would like to be able to click the banner at the top and have it redirect me to somewhere different depending on which forum i am viewing.

Code:
<if $thread['fid'] == 7 then>
Forum 7
<elseif $thread['fid'] == 8 then>
Forum 8
<elseif in_array($thread['fid'], array(1,2,3) then>
Forums 1,2,3
<else>
All other forums
</if>

Hi, I'm using this code in 1.8, but there is " = " in red:

[Image: 1q5oha8.png]

Different body IDs for forum ID, so for example I can have background-color for <li> of a menu if I'm in fid 128..but the equal symbol is red Frown although it's red, is okay?

EDIT: also <if in_array($thread['fid'], array(1,4,22)) then> seems not work Frown

Ok, resolved array with:

PHP Code:
<if in_array($GLOBALS['fid'], array(1,4,22)) then>

and works perfectly

and other code fid with:

PHP Code:
<if ($GLOBALS['fid'] == 128) then>


only there is always = in red

I can't believe you're fretting over some red text.
I think it makes it look sexy.
Rofl sometime I'm finicky Ouch
Reference URL's