Which is correct method to exclude more than one forum in this

Want to chit chat about anything, do it here ... posting here won't increase your post count (or shouldn't!). Please do not post any "phpBB" specific topics here unless they do not fit into the category above. Do not post bug reports, feature or support requests!
Forum rules
Please do not post any "phpBB" specific topics here unless they do not fit into the category above.

Do not post bug reports, feature or support requests! No really... Do not post bug reports, feature or support requests! Doing so will make Bertie a very sad bear indeed. :(
Post Reply
mrgtb
Registered User
Posts: 221
Joined: Wed Nov 28, 2007 10:09 pm

Which is correct method to exclude more than one forum in this

Post by mrgtb »

I saw this posted by somebody as a way to exclude more than one forum using a template conditional, which I want to use to wrap around a twitter button. I'm not sure when you use AND, and when it should be OR instead.

Code: Select all

<!-- IF FORUM_ID != 2 and FORUM_ID != 3 and FORUM_ID != 4 -->
But is that correct using AND, should it not be OR instead.

Code: Select all

<!-- IF FORUM_ID != 2 or FORUM_ID != 3 or FORUM_ID != 4 -->
I thought you only used AND when you add another conditional into it like this.

Code: Select all

<!-- IF FORUM_ID != 2 or FORUM_ID != 3 or FORUM_ID != 4 and S_REGISTERED_USER -->

mrgtb
Registered User
Posts: 221
Joined: Wed Nov 28, 2007 10:09 pm

Re: Which is correct method to exclude more than one forum in this

Post by mrgtb »

I think I've sussed this one out myself, I tested using this.

Code: Select all

<!-- IF FORUM_ID != 2 or FORUM_ID != 3 or FORUM_ID != 4 -->
That doesn't actually seem to work in exuding the forums listed, so thinking AND is right way as that does work.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1904
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: Which is correct method to exclude more than one forum in this

Post by DavidIQ »

Something like this:

Code: Select all

<!-- IF 3 != 2 or 3 != 3 or 3 != 4 -->
Would return true since the second first and third checks would be true. Only one has to be true for the whole expression to be true. Using "And" would mean that all have to be true to return a true which is why it is correct to use it in your case.
Image

User avatar
Pony99CA
Registered User
Posts: 986
Joined: Sun Feb 08, 2009 2:35 am
Location: Hollister, CA
Contact:

Re: Which is correct method to exclude more than one forum in this

Post by Pony99CA »

The second check (3 != 3) would return False. The expression would be true because checks 1 and 3 are True.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1904
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: Which is correct method to exclude more than one forum in this

Post by DavidIQ »

Pony99CA wrote:The second check (3 != 3) would return False. The expression would be true because checks 1 and 3 are True.

Steve
Typo...you are correct. Fixed.
Image

Post Reply