Forum Moderators: martinibuster

Message Too Old, No Replies

Placing adsense coding in a php include file

will it affect anything?

         

spica42

1:34 am on Jun 6, 2004 (gmt 0)

10+ Year Member



Can I place adsense coding in a php include file?

As above.

I'm creating a new site and I'm considering between skyscraper format or the towers. I know this topic has been discussed many time. after reading throw most threads, I'm still in a dilemma. Any more advice?

ignatz

1:47 am on Jun 6, 2004 (gmt 0)

10+ Year Member



FWIW, That's the way I use them... (via php includes)

dvduval

1:57 am on Jun 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can definitely do this. To the browser, it knows nothing of the include file. If you ""view source", the end result is the same as a standard html file. Go for it!

JohnKelly

2:25 am on Jun 6, 2004 (gmt 0)

10+ Year Member



Yes, this is easily done and allows coding so that you can block your own IP address from viewing ads (to prevent accidental clicks).

dvduval

2:33 am on Jun 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can you give us a pointer on blocking your own ip address?

richmondsteve

4:12 am on Jun 6, 2004 (gmt 0)

10+ Year Member



PHP is server-side. It generates static HTML which is outputed to the browser. There is no difference between AdSense shown via static HTML, an SSI include, a server-side PHP include or a server-side include via Perl, ASP, CF or any other language.

Can you give us a pointer on blocking your own ip address?

<?php

$my_ips = array( '<ip_1>', '<ip_2>', ..., '<ip_n>' );

if ( in_array( $ip, $my_ips ) )
{
show_adsense();
}
else
{
show_something_else();
}

?>

The following environment variables will be useful: REMOTE_ADDR, HTTP_X_FORWARDED_FOR.

Swash

1:06 am on Jun 8, 2004 (gmt 0)

10+ Year Member



Be careful though, to not use this include file on any pages that would be against googles TOS like non-content pages such as welcome pages, thankyou pages etc.