Forum Moderators: martinibuster

Message Too Old, No Replies

Adsense Integration

         

rysolag

10:55 am on Feb 20, 2005 (gmt 0)

10+ Year Member



Hi,

I have a site whos pages look like this:

<?php

$site = "";

$site .= "<html>";

$site .= "the site";

$site .= "</html">;

print $site;

?>

So on each page you build one string and then print it at the end.

Can I integrate adsense into this site like this?:

$site .= "the adsense chunck";

Was wondering if this wouldn't work because the adsense block is javascript or something.

thanks

snoremaster

11:28 am on Feb 20, 2005 (gmt 0)

10+ Year Member



It'll certainly work but you might as well do multi line such as

$html .= "
<script type=\"text/javascript\"><!--
google_ad_client = \"pub-nnnn\";
... etc ...

";

I usually make a function like google_ad($format="250x250") and depending on the value of $format serve a different ad. I think this would be a more relevant question in a PHP forum though.

whitenoise

11:01 am on Feb 21, 2005 (gmt 0)

10+ Year Member Top Contributors Of The Month



Putting the adsense code into an include is also a great time saver.

YesMom

12:20 pm on Feb 21, 2005 (gmt 0)

10+ Year Member



I use different server side include blocks for 75% of each page I create. Then the other 25% is unique content. SSI's are well worth the time it takes to learn how they work! If you invest the time to learn this coding trick, you will be very happy with the new found power to control hundreds of pages of your website with the manipulation of only one file.

Search Google on these terms:

SSI - (server side includes)
parsing .shtml
.htaccess

Advice for newbies to website building:

Just keep reading and learning about it. Coding "by hand" gives you more power and flexibility over your sites. If you are going to have a BIG site, plan ahead with a good foundation of code for each page.