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

XF 1.1 How to exclude content from home page

Discussion in 'XenForo Questions and Support' started by System0, Mar 4, 2012.

  1. System0

    System0 Active Member

    I'm using the ad_above_content template to display a 728x90 banner above my threads and forum lists. Unfortunately, this also places the banner on the home page just above the forum list and displays the banner over the sidebar.

    (I do think that this needs to be addressed. Perhaps another ad template needs to be created because on all pages the area above the content spans the full length of the page whereas the home page has the sidebar. )

    I know that this can be done using if statements but I'm unsure as to how to call the home page template.

    Does anyone know the if statement that I need to use in order to exclude content that is placed there with the ad_above_content template.

  2. Brogan

    Brogan XenForo Moderator Staff Member

    System0 likes this.
  3. System0

    System0 Active Member

    Thanks Brogan. Worked a charm.

    Though I noticed some other pages such as the member list that have a sidebar too. Is there a way to only show the ad on pages with no sidebar.
  4. Brogan

    Brogan XenForo Moderator Staff Member

    There isn't a way of automatically excluding it from all pages with a sidebar as there is no common reference; you will need to add each template into the conditional statement.
  5. System0

    System0 Active Member

    ok. I can just add a template to the if statement whenever I find one :)

    I tried this but it didn't work. Any ideas what I did wrong?

    <xen:if is="{$contentTemplate} != 'forum_list' OR {$contentTemplate} != 'member_list'">
  6. Rob

    Rob Well-Known Member

    Try this (hope my syntax is correct)

    <xen:if is="!({$contentTemplate} == 'forum_list' OR {$contentTemplate} == 'member_list')">
    System0 likes this.
  7. Brogan

    Brogan XenForo Moderator Staff Member

    Use AND.

    <xen:if is="{$contentTemplate} != 'forum_list' AND {$contentTemplate} != 'member_list'">
    System0 likes this.
  8. Mike

    Mike XenForo Developer Staff Member

    <xen:if is="!{$sidebar}">
    That may work, depending on the template you're trying it in.
    ArnyVee, Rob, Brogan and 1 other person like this.
  9. System0

    System0 Active Member

    Rob/Brogan - Got it working now. Many thanks :)
  10. System0

    System0 Active Member

    That worked great Mike. I've replaced Brogans suggestion (which also worked) with your code as it's simpler and will ensure that the ad will never be posted on any page with a sidebar.
  11. Brogan

    Brogan XenForo Moderator Staff Member

    Nice one Mike, I didn't think that would work.

    I'll add that one to the FAQ :)

Share This Page