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

XF 1.5 Placing ad on "resource page" but hide it on it's thread

#1
Greetings everyone. I'm working on my forum almost for one month.

A few days ago I started placing ads and placed an ad on resource_view_header template just before
<xen:hook name="resource_view_header_after_info" /> code.

Problem is my "normal" (not the resources' one) threads already got 3 adsense ads and with this ad there is 4 adsense ads on resource's threads.

I want to hide this ad from thread_view template but code is'nt working. I'm using this conditional to hide it from threads but it'snt working:
Code:
<xen:if is="!in_array({$contentTemplate}, array('thread_view'))">
AD CODE WAS HERE
</xen:if>
Please help me in this case. @Brogan @Chris D @Mike
 

wang

Well-known member
#4
Greetings everyone. I'm working on my forum almost for one month.

A few days ago I started placing ads and placed an ad on resource_view_header template just before
<xen:hook name="resource_view_header_after_info" /> code.

Problem is my "normal" (not the resources' one) threads already got 3 adsense ads and with this ad there is 4 adsense ads on resource's threads.

I want to hide this ad from thread_view template but code is'nt working. I'm using this conditional to hide it from threads but it'snt working:
Code:
<xen:if is="!in_array({$contentTemplate}, array('thread_view'))">
AD CODE WAS HERE
</xen:if>
Please help me in this case. @Brogan @Chris D @Mike
You can check for resource threads with this code. And add the not true operator which will hide it from resource threads.

HTML:
<xen:if is="!{$thread}">
Add code
</xen:if>
 
#5
Don't put the ad in the header template, just put it in the resource template.
I added ad code to the resource_view_header. Just above of <xen:hook name="resource_view_header_after_info" /> code.
You can check for resource threads with this code. And add the not true operator which will hide it from resource threads.

HTML:
<xen:if is="!{$thread}">
Add code
</xen:if>
When I include ad code between these code, it hides that ad on both resource and resource thread pages.
 

wang

Well-known member
#6
.

When I include ad code between these code, it hides that ad on both resource and resource thread pages.
My apologies sir. I had not tested the code. Please try this code instead. It is tested and it does what you want. It will show the ads on resources, but it will hide it on all threads.

HTML:
<xen:if is="{$controllerName} != 'XenForo_ControllerPublic_Thread'">
Ad code
</xen:if>
 
#7
My apologies sir. I had not tested the code. Please try this code instead. It is tested and it does what you want. It will show the ads on resources, but it will hide it on all threads.

HTML:
<xen:if is="{$controllerName} != 'XenForo_ControllerPublic_Thread'">
Ad code
</xen:if>
Thank you SO MUCH @wang !