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

the Ad Placements

Discussion in 'XenForo Questions and Support' started by Carlos, Mar 13, 2011.

  1. Carlos

    Carlos Well-Known Member

    Okay, so I upgraded xenforo from RC3 to stable 1.0.0 a few days ago, I reverted all the templates and re-added them.

    I bumped into a new problem: Getting the Ad Placements working.

    At first, I was confused what to do with regards to them. So I gave them a whirl. I mean, the new ones that got added in the final version of xenforo, not the pre-existing one that I had to find the line of code in page-container and/or forum_view.

    When I reverted the old templates, I let go of the old ad placements, and re-added them to the new ad placement system. Only this time, without the borders so that I can com back a later time with a fix.

    I added the ads into the new adplacements: At first the ads did not show up to the main forum page [ya know, the first thing you see when you get to your xenforo instance], but it showed up only after I cleared my browser's cache.

    BUT the "message" display [ya know the threads you read or post in] did NOT show the ads that's supposed to be globally shown.

    However, when I added the old ad placement banner to the page container template, not only does the old template that was was on the sidebar show up, but the NEW ad placement showed up too!

    Here's an image of what I mean, Keep in mind, this is a default thread display, the old ad placement is on the top, the new one [the one without the border] is on the bottom, you will see the difference.
    mvc3ad.png

    To see another thread example, here it is.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    You've posted this in bug reports but you've prefixed the thread [Tweak].

    If you're reporting a bug can you state clearly what you think it is?
    I've read your post but I'm afraid I can't really understand what it is you're trying to convey.
     
  3. Carlos

    Carlos Well-Known Member

    I don't want the team to think that the ad placement need well ....an overhaul, but it IS a bug (at least I think so)... usually when something doesn't work like its supposed to, devs scrap the ideas and re-fix them as something else (ahem; I'm looking at you vBulletin).

    So, instead of treating it as a suggestion, I ask of the xenforo team to tweak the feature a bit more.

    I don't want two ad placements, I want only one per thread... which is what the "problem" lies.
     
  4. Mike

    Mike XenForo Developer Staff Member

    I can't say I understand what you're reporting at all.

    I see ads in the sidebars. I don't know what code or conditions or templates you've used, so I don't know what you're expecting to show up. Obviously there are some outside template changes still in your style, so I don't know if they're interfering.

    We need to know exactly what you did (templates, code, etc), exactly what's happening, and exactly what you expect to happen. I also recommend that you add the elements to a completely default style to see if they appear there.
     
  5. Carlos

    Carlos Well-Known Member

    What Happened:
    Before the upgrade I had this code on my page container template:
    Code:
    <xen:sidebar>
    <div class="section">
            <div class="secondaryContent">
                <center><script type="text/javascript"><!--
    google_ad_client = "private";
    /* private */
    google_ad_slot = "private";
    google_ad_width = nip;
    google_ad_height = nip;
    //-->
    </script>
    <script type="text/javascript"
    src="google">
    </script></center>
            </div>
        </div></xen:sidebar>
    Whereas, for the ad_sidebar_bottom template, I left the pre-set code well alone:
    Code:
    <xen:hook name="ad_sidebar_bottom" /><center><script type="text/javascript"><!--
    google_ad_client = "private";
    /* private */
    google_ad_slot = "private";
    google_ad_width = nip;
    google_ad_height = nip;
    //-->
    </script>
    <script type="text/javascript"
    src="google">
    </script></center>
    What went wrong:
    The [new] ad placement did not work at first on the mainpage. It works now. That's not the problem now; the problem is that the [new] ad placement DOES not show up [in thread-view] even if I had already added to the [new sidebar] ad placement.

    How'd you solve it?
    I re-added this template:
    Code:
    <xen:sidebar>
    <div class="section">
            <div class="secondaryContent">
                <center><script type="text/javascript"><!--
    google_ad_client = "private";
    /* private */
    google_ad_slot = "private";
    google_ad_width = nip;
    google_ad_height = nip;
    //-->
    </script>
    <script type="text/javascript"
    src="google">
    </script></center>
            </div>
        </div></xen:sidebar>
    ...To the thread_view template.

    Keep in mind, this code is the old code that I used BEFORE the upgrade.

    What happens when you press "save" after making these adjustments?
    It displays both the old template and the new ad_sidebar_bottom template.

    What was your intention?
    My intention was for the code that I entered into ad_sidebar_bottom to be displayed across "forum home" and "thread_view." But "forum home" ad works only after clearing cache, and the "thread_view" ad only works when something else [such as my old ad template I spoke of earlier] is in the template.

    Make sense now?
     
  6. Mike

    Mike XenForo Developer Staff Member

    Well that makes sense doesn't it? There's no sidebar on the thread view normally - you're creating one with the <xen:sidebar> tag, and you're putting an ad into it. It then displays the sidebar with the ad you explicitly put into it as well as the ad in the ad location template.

    If you want to force the sidebar on that page (without the duplicate ad), you'll have to add the <xen:sidebar> tag (and give it some sort of content, such as <div></div>).
     
    yoghurtfarmer likes this.
  7. yoghurtfarmer

    yoghurtfarmer Well-Known Member

    Add <xen:sidebar><div></div></xen:sidebar>

    Thread view doesn't come with a sidebar normally, that's why the ad doesn't show up.

    When you add in your old code, you've now added the sidebar to thread view, so the new ad will show up. But since you have your old ad code within the sidebar tags, you end up with 2 ads.
     
  8. Carlos

    Carlos Well-Known Member

    Finally!

    Thanks to Mike and Yoghurtfarmer! :)

    EDIT: I'm going to remove the old ad template, but the question now is, where should I put the <xen:sidebar><div></div></xen:sidebar> code? ad_sidebar_bottom?
     
  9. Brogan

    Brogan XenForo Moderator Staff Member

    I've moved this thread out of the bug reports forum then based on your last post.
     
  10. Carlos

    Carlos Well-Known Member

    Aye! Aye! :)

    Thanks, brogan. Stop working overtime! Sheesh!
     

Share This Page