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

XF 1.3 Mobile Ads Problem

#1
My mobile advertises overflow from my phone screen.I am using 320x50 mobile banner and iphone4s.

Here is the picture that explains my problem :

How can I centralize mobile banner and fix overflowing ? I tried to delete <!center> tag , nothing changed.

PHP:
<xen:hook name="ad_above_content" />
<xen:if is="!{xen:helper ismemberof, $visitor, 3,9}">

<xen:if is="in_array({$contentTemplate}, array('forum_list', 'forum_view', 'EWRporta_Portal'))">
<center><script type="text/javascript">
                            google_ad_client = "ca-pub-xxxxxxx";
                            width = document.documentElement.clientWidth;
                            /* Message Below Responsive 2 */
                            google_ad_slot = "xxxxxxx";
                            google_ad_width = 320;
                            google_ad_height = 50;
                                if (width > 619) {
                                /* Message Below Responsive 1 */
                                google_ad_slot = "xxxxxxx";
                                google_ad_width = 468;
                                google_ad_height = 60;
                                }
                                    if (width > 879) {
                                    /* Message Below */
                                    google_ad_slot = "xxxxxxx";
                                    google_ad_width = 728;
                                    google_ad_height = 90;
                                    }
                            </script>
                            <script type="text/javascript"
                            src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                            </script></center>
                          

</xen:if>


</xen:if>
 

Brogan

XenForo moderator
Staff member
#2
You have margin applied to the main content, hence why a 320px wide ad doesn't fit on a 320px wide screen.

You will need to remove the margin or use a smaller ad.
 

Tracy Perry

Well-known member
#5
That ad needs to be 234x60
Really? ;)
image.jpg

Code:
<xen:if is="!in_array({$contentTemplate}, array('error', 'message_page', 'message_page', 'search_form', 'search_form_post', 'search_form_profile_post', 'xengallery_search_form_media', 'search_results', 'register_form','Foolbothoneypot_register_form', 'login', 'error_with_login', 'thread_view'))">
<p id ="adsense_ad">
<script type="text/javascript">
    google_ad_client = "ca-pub-0193516818551678";
width = document.documentElement.clientWidth;
    width = document.documentElement.clientWidth;
    google_ad_slot = "7151120818";
    google_ad_width = 320;
    google_ad_height = 50;
        if (width > 483) {
        google_ad_slot = "5674387618";
        google_ad_width = 468;
        google_ad_height = 60;
    }
if (width > 1050) {
        google_ad_slot = "4197654413";
        google_ad_width = 728;
       google_ad_height = 90;
    }
   
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</xen:if>
 

Tracy Perry

Well-known member
#7
You don't have any left or right margin, which is the other option I mentioned in my post.
@Brogan, if you were referring to my post - most correct sir.
That's why I have a <p id> in there (don't ask me why I used that - I've forgotten now and it may not be correct but it works). In EXTRA.css I style it.
 

tommydamic68

Well-known member
#8
Really? ;)
View attachment 70064

Code:
<xen:if is="!in_array({$contentTemplate}, array('error', 'message_page', 'message_page', 'search_form', 'search_form_post', 'search_form_profile_post', 'xengallery_search_form_media', 'search_results', 'register_form','Foolbothoneypot_register_form', 'login', 'error_with_login', 'thread_view'))">
<p id ="adsense_ad">
<script type="text/javascript">
    google_ad_client = "ca-pub-0193516818551678";
width = document.documentElement.clientWidth;
    width = document.documentElement.clientWidth;
    google_ad_slot = "7151120818";
    google_ad_width = 320;
    google_ad_height = 50;
        if (width > 483) {
        google_ad_slot = "5674387618";
        google_ad_width = 468;
        google_ad_height = 60;
    }
if (width > 1050) {
        google_ad_slot = "4197654413";
        google_ad_width = 728;
       google_ad_height = 90;
    }
  
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</xen:if>
Your ads are not right.

image.jpg
 

Tracy Perry

Well-known member
#9
Actually I WANT the ad to be the full width and not match the breadcrumb and post area. The TWD site has been a "little" neglected on fine tuning lately as I've been busy setting up a new dedicated server and then installing multiple VPS's on it to move my forums over to. ;)
My Apple site is facing the same problem with not enough time right now. The upgrade to 1.3 changed a few things up that I need to modify for.

And actually on the iPhone it does as I want with the exception of the left margin (which is going to relate to the style itself changing up some.
image.jpg

A simple movement of the add to the ad_header location broke it out of the styling that was being forced on it.
image.jpg

My Apple site follows the same format (and just noticed I need to do some work on the logo - I never log in on the phone on that site).
image.jpg
 
Last edited: