XF 2.2 Revisiting "placing ads at top of specific forums"

C Allingham

Member
Revisiting this post from 2015: https://xenforo.com/community/threads/place-ads-at-top-of-specific-forums.89384/post-875551

If I understand you correctly, you want to have a select number of pages which are ad-free ... try this...

Code:
Code:
<xen:if is="{$forum.node_id} != x">
<!-- Your Ad Code -->
</xen:if>
What this does is output <!-- Your Ad Code --> everywhere but in {$forum.node_id} X.

I want to do the opposite. I want to show an ad on all pages in ONE node only.

I updated the code like this but she don't work.

Code:
<xf:if is="{$forum.node_id} == 63">
Display an ad here...
</xf:if>

The node in question is https://tvwbb.com/forums/q-a-with-harry-soo.63/ and "Advertisement is active" is checked.

Don't be confused by the AdSense ad appearing on the page. That ad will be replaced by this one if I can get it to work. For now, the sample text "Display an ad here..." should be appearing below the AdSense ad.

Any help is appreciated!
 
Which template are you adding the code to?

Not all variables are available everywhere - you likely need to use something like this:
HTML:
<xf:if is="{$__globals.forum.node_id} == 63">
 
I didn't place the code in a template, I used Setup > Advertising, created a new ad and placed the code it in the advertisement HTML.

I've used conditional statements before in ads so I thought it would work. For example, I'm currently using this to place an ad at the top of the forum list page ONLY.

<xf:if is="$xf.reply.template == 'forum_list'">
ad code goes here
</xf:if>

I switched to your code and it works!
 
Back
Top Bottom