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?

Link to comment
Share on other sites

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>';

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.