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

XF 1.4 Hide Ads in X Forum?

Discussion in 'XenForo Questions and Support' started by Michael, Mar 21, 2015.

  1. Michael

    Michael Active Member

    I am wanting to hide ads in a specific forum and from all threads within that forum, the templates I use are a couple of the ad templates and my own custom template which is grabbed within the thread_view template.

    Anyone know how to do this I have tried with this:
    <xen:if is="!{$forum.node_id} == 44">

    But that only works in some templates.

    Thank you.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Which ad templates are you using that in?

    It will only work if the parameter is available in the template.
     
  3. Michael

    Michael Active Member

    I have tried adding this to the top of the thread_view template in the <head>:

    <xen:container var="$forumId">{$forum.node_id}</xen:container>

    and then using the

    <xen:if is="!{$forum.node_id} == 44">

    But it doesnt appear to have any effect and hides the content within all nodes instead of the one.
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Use <xen:if is="{$forum.node_id} != 44">
     
    Michael likes this.
  5. Michael

    Michael Active Member

    Thank you so much Brogan, do you know how to make that work for multiple forums to hide ads in those too? It works perfectly now, I also moved the container code to the top of the page_container template.
     
  6. Brogan

    Brogan XenForo Moderator Staff Member

  7. Michael

    Michael Active Member

    Thank you I tried but it didnt work for me I used:

    <xen:if is="!in_array({$forum.node_id}, array(44, 52))">
     
  8. Michael

    Michael Active Member

    Anyone know how I can convert <xen:if is="{$forum.node_id} != 44"> to an array so I can use multiple forum IDs?
     
  9. Brogan

    Brogan XenForo Moderator Staff Member

    This is the syntax:
    Code:
    <xen:if is="!in_array({$forum.node_id}, array(x, y, z))">
     
    Michael likes this.
  10. Michael

    Michael Active Member

    Thanks Brogan I tried again, it was cached and I was seeing zero changes, upon emptying the cache it works as intended :D
     

Share This Page