Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Some help with this if statement is appreciated
Ukshep Offline
Junior Member
**
Posts: 9
Joined: Oct 2014
Post: #1
Some help with this if statement is appreciated
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.
(This post was last modified: 10-25-2014 09:26 AM by Ukshep.)
10-25-2014 08:46 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Some help with this if statement is appreciated

Code:
1
2
3
4
5
6
7
8
9
<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>


My Blog
10-25-2014 10:28 PM
Find all posts by this user Quote this message in a reply
nier3 Offline
Member
***
Posts: 125
Joined: Jul 2012
Post: #3
RE: Some help with this if statement is appreciated
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

(This post was last modified: 11-30-2014 04:27 AM by nier3.)
11-30-2014 12:40 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #4
RE: Some help with this if statement is appreciated
I can't believe you're fretting over some red text.
I think it makes it look sexy.

My Blog
(This post was last modified: 11-30-2014 11:33 AM by ZiNgA BuRgA.)
11-30-2014 11:33 AM
Find all posts by this user Quote this message in a reply
nier3 Offline
Member
***
Posts: 125
Joined: Jul 2012
Post: #5
RE: Some help with this if statement is appreciated
Rofl sometime I'm finicky Ouch
11-30-2014 01:48 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: