1. 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

Discussion in 'Styling and Customization Questions' started by Ozan Çorumlu, Dec 18, 2015.

  1. Ozan Çorumlu

    Ozan Çorumlu New Member

    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:
    <xen:if is="!in_array({$contentTemplate}, array('thread_view'))">
    Please help me in this case. @Brogan @Chris D @Mike
  2. Ozan Çorumlu

    Ozan Çorumlu New Member

    Up. No one ever met with this problem? It's really annoying problem and even developers dont answer on it...
  3. Brogan

    Brogan XenForo Moderator Staff Member

    Don't put the ad in the header template, just put it in the resource template.
  4. wang

    wang Well-Known Member

    You can check for resource threads with this code. And add the not true operator which will hide it from resource threads.

    <xen:if is="!{$thread}">
    Add code
  5. Ozan Çorumlu

    Ozan Çorumlu New Member

    I added ad code to the resource_view_header. Just above of <xen:hook name="resource_view_header_after_info" /> code.
    When I include ad code between these code, it hides that ad on both resource and resource thread pages.
  6. wang

    wang Well-Known Member

    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.

    <xen:if is="{$controllerName} != 'XenForo_ControllerPublic_Thread'">
    Ad code
    Ozan Çorumlu likes this.
  7. Ozan Çorumlu

    Ozan Çorumlu New Member

    Thank you SO MUCH @wang !
    wang likes this.
  8. wang

    wang Well-Known Member

    You are most welcome sir :)
    Ozan Çorumlu likes this.

Share This Page