Jump to content

[SOLVED] Adsense Javascript inside PHP array


transparencia

Recommended Posts

There is this code inside an array:

 

$data[0] = "<p style=\"color: #000000;font-family: Arial, sans-serif;font-size: 11px;...." 

 

I would like to paste the Javascript adsense code in this variable $data[0] but the adsense javascript needs a specific format and if that format is changed, it doesn't output the ad.

 

The adsense script is this:

 

 <script type="text/javascript"><!--
google_ad_client = "pub-000000000000";
/* mp3 player */
google_ad_slot = "0000000000";
google_ad_width = 125;
google_ad_height = 125;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

 

I believe I need to put it in one line and escaped like this:

 

]<script type=\"text/javascript\"><!-- google_ad_client = \"pub-000000000000\"; /* mp3 player */ google_ad_slot = \"0000000000\";google_ad_width = 125; google_ad_height = 125; //--> </script> <script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">
</script>

 

But this however doesn't output the ad, too.

 

Any help?

wrap it in single quotes instead, this way you dont have to escape every singe double quote, ex:

$data[0] = '<script type="text/javascript"><!--
google_ad_client = "pub-000000000000";
/* mp3 player */
google_ad_slot = "0000000000";
google_ad_width = 125;
google_ad_height = 125;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>';

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.