MyBB Hacks

Full Version: Conditional challenge (several ORs + one AND (of ORs))
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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>

Lemme try!

*rubs hands*
[Image: SmileyBow.gif]

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

Thank you so much!
Reference URL's