Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Conditional challenge (several ORs + one AND (of ORs))
Sector Offline
Junior Member
**
Posts: 6
Joined: May 2012
Post: #1
Conditional challenge (several ORs + one AND (of ORs))
First, congratulations for this great plugin.

Now the challenge: Can I add an AND to these ORs?

Quote:<if ($forum['fid'] == 11) || ($forum['fid'] == 12) || etc... etc...  || ($forum['fid'] == 20) then>
Event 1
<else>
Event 2
</if>

I need an AND that will be mandatory condition for Event1 to happen. In this case Theme ID must be, say, "2" OR "4".

And there's a catch: many people use the default theme (ID=0). Thus the condition must know what's the Theme currently applied as default too, because it must always apply when Theme ID #2 or Theme ID #4 are being displayed.

So, what I want is something like IF ((forum=1 or forum=2 or forum=3, etc) AND (theme=2 OR theme=4)) THEN event 1, ELSE event 2.

Tricky, hm?
(This post was last modified: 05-30-2012 01:21 PM by Sector.)
05-30-2012 12:31 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #2
RE: Conditional challenge (several ORs + one AND (of ORs))
Do you mean this?

PHP Code:
<if ($forum['fid'] == 112 || $forum['fid'] == 3) && ($theme['tid'] == 2 || $theme['tid'] == 4) then>
Event 1
<else> 
Event 2
</if>


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
05-30-2012 01:55 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Sector Offline
Junior Member
**
Posts: 6
Joined: May 2012
Post: #3
RE: Conditional challenge (several ORs + one AND (of ORs))
Lemme try!

*rubs hands*
05-30-2012 02:04 PM
Find all posts by this user Quote this message in a reply
Sector Offline
Junior Member
**
Posts: 6
Joined: May 2012
Post: #4
RE: Conditional challenge (several ORs + one AND (of ORs))
[Image: SmileyBow.gif]

Worked with a minor adjustment: if ((extra) || (parenthesis)) && ((extra) || (parenthesis)) then etc.

Thank you so much!
(This post was last modified: 05-30-2012 03:04 PM by Sector.)
05-30-2012 03:03 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: