News:

Wondering if this will always be free?  See why free is better.

Main Menu

Small help please

Started by skb, January 12, 2017, 06:39:07 AM

Previous topic - Next topic

skb

For one mod button that I don't want displayed in some boards, I used (in display.template)
if ($context['current_board'] != 17)

How do I add more board numbers to that statement ? Or a better line of code which I'm sure there must be.

SMF 2.1.4 / TP 2.2.2

Shambles

You probably want to use in_array


$excludes = array(16,17,18,19);
if (!in_array($context['current_board'], $excludes)) {

skb

Thanks Shambles. It works very well and I am grateful.
I had to remove the "{" at the end as I used this statement at the beginning of the section where the Mod's code started. Otherwise it was giving me a parse error. I suppose adding a "}" to close the statement would have helped, but that is what I did.

SMF 2.1.4 / TP 2.2.2

Arantor

The { means "this condition applies to the following section" and carries on until it hits the closing }.

Shambles

^ as above

I added the opening brace for clarity...

skb

I understand. Thanks again.

SMF 2.1.4 / TP 2.2.2

Advertisement: