Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jul 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    abstracting google ads to get strict xhtml site

    I found this article which was kind of interesting re: google adsense in strict xhtml sites: http://www.webwicked.com.au/journalentry-29.html.

    I am trying it but it is a bit above my head considering I am not entirely sure that I can even embed an object successfully.

    So what I have done is create a file called google.php with the following text:
    Code:
    <?php header("Content-Type: text/html;charset=utf-8"); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html lang="en">
      <head>
        <title>Sponsorship</title>
        <style type="text/css">
          body { margin: 0; padding: 0; width: 728; height:90}
        </style>
      </head>
      <body>
        <script type="text/javascript">
    <!--
    google_ad_client = "VALUE HERE";
    google_alternate_color = "FFFFFF";
    google_ad_width = 728;
    google_ad_height = 90;
    google_ad_format = "728x90_as";
    google_ad_type = "text_image";
    google_ad_channel = "";
    google_color_border = "000000";
    google_color_bg = "FFFFFF";
    google_color_link = "0000FF";
    google_color_text = "000000";
    google_color_url = "CC0000";
    google_ui_features = "rc:6";
    //-->
        </script>
        <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
      </body>
    </html>
    Then I called this in my page like this:
    Code:
    	<object data="/wkyp/jsfiles/googles.php" type="text/html"></object>
    This is in this page: http://d691798.i86.quadrahosting.com.au/wkyp/

    Needless to say it doesnt work but if anyone can see easily a mistake I could have made, I would really appreciate it

    Thanks!
    Vivienne

  • #2
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,300
    Thanks
    28
    Thanked 275 Times in 269 Posts
    I’m not sure what your issue is, but I can make some suggestions.

    • Assign a width and a height to the object element. An HTML document has no intrinsic dimensions.
    • Correct the embedded style sheet. Length values require a unit identifier, such as px.
    • Remove the SGML comment tags (<!-- and -->) around the script. They don’t do anything in modern browsers and are detrimental in XHTML documents. May as well not use them in HTML either.
    • Make sure that ad‐blocking software is not blocking any of your ads. Several of them were blocked by my Firefox Adblock extension.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #3
    New Coder
    Join Date
    Jul 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks so much for taking the time to look at it.

    So you did get ads? That is so strange I cant get any in any browser type.

    I made the changes you suggested. Regarding the other comments:

    Assign a width and a height to the object element. An HTML document has no intrinsic dimensions.
    Wouldnt the body { margin: 0; padding: 0; width: 728; height:90}
    part of the php file do that?


    Make sure that ad‐blocking software is not blocking any of your ads. Several of them were blocked by my Firefox Adblock extension.
    So for google ads generally is there a way to only present ads that arent blocked? I don't suppose there is - I see google ads on most sites these days, how does that work? I suppose that is off topic for a css forum though


    vivienne

  • #4
    Senior Coder ahallicks's Avatar
    Join Date
    May 2006
    Location
    Lancaster, UK
    Posts
    1,134
    Thanks
    1
    Thanked 57 Times in 55 Posts
    For a start:

    body { margin: 0; padding: 0; width: 728; height:90}

    Should read:

    body { margin: 0; padding: 0; width: 728px; height:90px;}

    And you should assign the height and width values to the object tag too of whatever height and width you want it to be. I'm not sure if IE would pick up the page in the object using that method here. I know for videos you have to use the flash satay method to get IE to display a video which involves using a param with name="src" and value being the same as the link to the video in the object tag. Might work for IE, but don't quote me.
    "write it for FireFox then hack it for IE."
    Quote Originally Posted by Mhtml View Post
    Domains are like women - all the good ones are taken unless you want one from some foreign country.
    Reputation is your friend

    Development & SEO Tools

  • #5
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,300
    Thanks
    28
    Thanked 275 Times in 269 Posts
    Quote Originally Posted by vivienne2 View Post
    So you did get ads?
    I white‐listed your page so that the ads weren’t blocked. The one at the top of your linked page started showing up, but the Google ads didn’t.

    Quote Originally Posted by vivienne2 View Post
    Wouldnt the body { margin: 0; padding: 0; width: 728; height:90}
    part of the php file do that?
    No, it’s not the same thing. The CSS contains errors in the first place because you forgot to append px to the end of the numbers. If that code was meant to specify the size of the object element, it should read:

    Code:
    object { display: block; width: 728px; height: 90px; }
    display: block is not strictly required, but I would add it anyway.

    Quote Originally Posted by vivienne2 View Post
    So for google ads generally is there a way to only present ads that arent blocked? I don't suppose there is - I see google ads on most sites these days, how does that work? I suppose that is off topic for a css forum though
    If you’re asking if there’s a way to prevent your ads from being blocked, I’d say, “not really”.

    Quote Originally Posted by ahallicks View Post
    I'm not sure if IE would pick up the page in the object using that method here.
    There are some display issues since Internet Explorer treats the object element like an iframe element, but it worked with HTML pages last time I checked. Not sure if it would work with the PHP file extension though. At any rate, I couldn’t see the ads in Firefox either.

    Quote Originally Posted by ahallicks View Post
    I know for videos you have to use the flash satay method to get IE to display a video which involves using a param with name="src" and value being the same as the link to the video in the object tag. Might work for IE, but don't quote me.
    Flash Satay uses name="movie". I know that you can use name="src" to get RealAudio files working though.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #6
    Senior Coder ahallicks's Avatar
    Join Date
    May 2006
    Location
    Lancaster, UK
    Posts
    1,134
    Thanks
    1
    Thanked 57 Times in 55 Posts
    Quote Originally Posted by Arbitrator View Post
    Flash Satay uses name="movie". I know that you can use name="src" to get RealAudio files working though.
    My mistake, so it does! And that's how I used it too.... *sigh*
    "write it for FireFox then hack it for IE."
    Quote Originally Posted by Mhtml View Post
    Domains are like women - all the good ones are taken unless you want one from some foreign country.
    Reputation is your friend

    Development & SEO Tools

  • #7
    New Coder
    Join Date
    Jul 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks

    I might give up on this one Its not the css anyway as they don't work embedded straight in a document of this type or in an external php file.

    back to the drawing board - anyway I learnt a lot from these forums and understand lots more about css which is great - THANKS GUYS!!
    Vivienne


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •