Forum Moderators: martinibuster

Message Too Old, No Replies

Adsense Code

Adsense Code

         

aff_dan

6:25 pm on May 16, 2005 (gmt 0)

10+ Year Member



I've been looking at this bit of code for so long I can't see for looking. Can some tell me what the correct syntax for this would be? I've highlighted the piece of code that I know is cauing the problem but I can't see for looking any more.
echo "<!-- google ads, generated by SW :: Google Ads (c) [ezinedir.com...] -->\r\n"
. "<table width=\"100%\"><tr><td align=\"center\"><br />"
. "<script language=\"javascript\">\r\n"
. "\r\n"
. "google_ad_client = \"" . $params->get('google_ad_client') . "\";\r\n"
. "google_alternate_ad_url = \"<a href='http://www.officialboard.co.uk/phpAds/adclick.php?n=aaee7455' target='_blank'><img src='http://www.officialboard.co.uk/phpAds/adview.php?what=zone:11&amp;n=aaee7455' border='0' alt='Speed Up The Web Today!'></a>;\" ."\r\n" <---
. "google_ad_width = " . $params->get('google_ad_width') . "; \r\n"
. "google_ad_height = " . $params->get('google_ad_height') . "; \r\n"
. "google_ad_format = \"" . $params->get('google_ad_format') . "\"; \r\n"
. "google_ad_channel = \"" . $params->get('google_ad_channel') . "\"; \r\n"
. ( $params->get('google_ad_in_frame')? "google_page_url = document.location; \r\n" : "")
. "google_ad_type = \"" . $params->get('google_ad_type') . "\"; \r\n"
. "google_color_border = \"" . $params->get('google_color_border') . "\"; \r\n"
. "google_color_bg = \"" . $params->get('google_color_bg') . "\"; \r\n"
. "google_color_link = \"" . $params->get('google_color_link') . "\"; \r\n"
. "google_color_url = \"" . $params->get('google_color_url') . "\"; \r\n"
. "google_color_text = \"" . $params->get('google_color_text') . "\"; \r\n"
. "//--> \r\n"
. "</script>\r\n"
. "<script language=\"javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></script>\r\n"
. "<!-- end of google ads -->\r\n"
. "</td></tr></table>";

Thanks

dan

Rodney

6:48 pm on May 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not sure about the syntax, but unless you got specific permission from Google regarding changing the ad code, you could run into some problems there.

I'm pretty sure they want you to just copy and paste the ad code to your site without any changes, even for scripts.

You may also want to remove your URL(s) from the post above as per this forums TOS.

jomaxx

6:54 pm on May 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is that PHP without the wrapper? All I can say is that I always have lots of problems with special characters that have to be escaped or otherwise substituted in. Look at things like the question marks and ampersands in the alternate URL; maybe even the exclamation points.

JohnKelly

7:02 pm on May 16, 2005 (gmt 0)

10+ Year Member



If it is PHP, try this:

print <<<EOF

*** AdSense code goes here ***

EOF;

That way you won't haev to escape characters and such.

StephenBauer

7:05 pm on May 16, 2005 (gmt 0)

10+ Year Member



John is spot on...makes things easier. Search for:

+PHP +"here documents"

in a search engine.

-----

Also:

;\" ."\r\n"

Should be:

;\"\r\n"

no?

(haven't done much with PHP or perl in a while)

StephenBauer

7:15 pm on May 16, 2005 (gmt 0)

10+ Year Member



Maybe this thread should be moved to the PHP forum here at WebmasterWorld?

[webmasterworld.com...]