• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Different Ads in Different Forums (Nodes)

lazer

Well-known member
#1
Hey all

Is there a way to place a banner or ad in a particular forum (thread_view) with a conditional?

Simply put:

I would like to have banner "A" in forum 1,2,3 & 5
I would like to have banner "B" in forum 4

So, some kind of "if" statement? I'm not really keen on installing an add-on to achieve this, if it can be avoided...

Cheers.
 

Chris D

XenForo developer
Staff member
#2
<xen:if is="in_array({$forum.node_id}, array(1, 2, 3, 5))">
Banner A
<xen:elseif is="{$forum.node_id} == 4">
Banner B
</xen:if>

I think that's it.
 

Chris D

XenForo developer
Staff member
#5
Absolutely.

Code:
<xen:if is="in_array({$forum.node_id}, array(1, 2, 3, 5))">
Banner A
<xen:elseif is="{$forum.node_id} == 4 AND !{$visitor.user_id}" />
Banner B
</xen:if>
That's just an example where if you're in forum ID 4 AND a guest then you will see banner B.

Lots of other combinations too. I'm sure you'll work it out :) But let us know if you need anything else.
 

craigiri

Well-known member
#7
FYI, I am doing the above by calling an outside ad banner program - with a variable that depicts the node.

This is useful if you have rotating ads in each forum as opposed to just a fixed banner.