1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. If you want premium products then purchase our VIP or SVIP plans
  3. Dont forget read our rules HERE Also anyone caught Leeching this content or Scamming will be banned on numerous networks.
    Dismiss Notice
  4. Dont forget we do not allow Multiple Accounts, so all of your accounts as well as your IP will be banned.
    Dismiss Notice
  5. Tired of Download Limits ? UPGRADE Today!
    Dismiss Notice

FREE Adding advertisements with template edits

Discussion in 'Xenforo Template Mods & Extras' started by HAWK, Mar 21, 2016.

  1. HAWK

    HAWK Administrator Staff Member ADMIN

    Likes Received:
    Trophy Points:
    1. Create a template for each ad you will place.
    I recommend this over placing the code directly in PAGE_CONTAINER or forum_list because it's much more manageable if you ever need to edit or change your ad. Xenforo also has a spectacular feature of showing which other templates have been included when you view a template.

    On my site http://www.forumvancouver.com/, I have 3 ads at the moment. The bolded names are the template names I chose.

    Top Leaderboard (adsense_top) - Above top breadcrumb and below navbar
    Wide Sidetower (adsense_tower) - On the sidebar at the bottom
    Bottom Leaderboard (adsense_bottom) - Above bottom breadcrumb

    2. Fill in the template with your ad code along with any conditions and CSS.
    For instance in adsense_top I have the following. The margin is to ensure that the search box doesn't overlap the ad when the window is resized smaller.
    <div style="text-align: center; margin-top:8px;">

    For adsense_bottom, I only want them to be shown to guests, so I put everything in between <xen:if is="!{$visitor.user_id}"></xen:if>
    <xen:if is="!{$visitor.user_id}">
        <div style="text-align: center;  padding: 7px;">

    3. Use the include function to place your ads in the appropriate template/spot
    Place <xen:include template="TEMPLATE NAME" /> where you want your ad to be.

    In the template PAGE_CONTAINER:
    For adsense_top, I placed it immediately BEFORE
    <xen:if is="{$showUpgradePendingNotice}">
    For adsense_bottom, I placed it immediately BEFORE
    <div class="breadBoxBottom">
    In the template forum_list:
    For adsense_tower, I placed it immediately BEFORE
    Note that the way I've done this incorporates adsense_tower only on the main page and the leaderboards to EVERY page on the forum.

    There are likely more conditions that you can add to limit what type of page the ads show up on, so if you figure them out, do share!

Share This Page