...

View Full Version : abstracting google ads to get strict xhtml site



vivienne2
07-10-2007, 01:02 PM
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:

<?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:

<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

Arbitrator
07-10-2007, 02:48 PM
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.

vivienne2
07-10-2007, 03:08 PM
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

ahallicks
07-10-2007, 03:13 PM
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.

Arbitrator
07-10-2007, 03:24 PM
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.


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:


object { display: block; width: 728px; height: 90px; }

display: block is not strictly required, but I would add it anyway.


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Ē.


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.


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.

ahallicks
07-10-2007, 05:48 PM
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*

vivienne2
07-11-2007, 01:02 AM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum