PDA

View Full Version : Conditional display of banners


RFID Talk
04-13-2007, 06:47 PM
Hi folks:

I believe this should be straightforward for experienced vBulletin hands, but I've been unable to figure it out.

We rotate banners from a number of advertisers across our forum at www.rfidtalk.com. But we have one forum in particular that has a fixed advertiser. To display just the banner from that advertiser, we need to use a different banner-display code snippet than the standard one. So, what I want to do is put in the header template a simple condition that will display the normal banner-display code snippet by default, or the fixed advertiser's code snippet otherwise. Like so:

If (forum = "Employment Forum") {
Display fixed-advertiser snippet
}
Else {
Display standard code
}

Any ideas?

Thanks!

Will

zardos
04-13-2007, 11:27 PM
<if condition="$forum[forumid] == X"></if>

HMBeaty
04-13-2007, 11:38 PM
BTW, you can't use php in templates ;)

Kungfu
04-13-2007, 11:48 PM
<if condition="$forum[forumid] == X"></if>

<if condition="$forum[forumid] == X"></if><else>do something else</else>

to expand onto that.

zardos
04-14-2007, 12:06 AM
<if condition="$forum[forumid] != 1">everywhere except 1</if>
<if condition="$forum[forumid] == 1">only in 1</if>

RFID Talk
04-17-2007, 01:32 PM
Thank you everyone for your responses.

I have tried your suggestions, but unfortunately it doesn't appear to be working. Only the ELSE part of the condition is ever executed, even when I'm in the forum whose forumid is specified in the IF condition. Here is the code I'm using in the header template:

<!-- banner -->
<br />
<div align="center">

<if condition="$forum[forumid] == 10"><iframe ad="special" width="728" height="90" ... more HTML ad code ... ></iframe></if>
<else><iframe ad="normal" width="728" height="90" ... more HTML ad code ... ></iframe></else>

</div>
<!-- /banner -->


So basically, even when I am in forum 10, the condition does not evaluate to true.

As another clue, using the HTML code below I attempted to display the $forum[forumid] variable in the header template to see what it's value was. But no value displays, leading me to believe that $forum[forumid] is null. Could it be that $forum[forumid] is not being set?
<strong>Forum:</strong> $forum[forumid]