[pmwiki-users] Include URL markup

Joachim Durchholz jo at durchholz.org
Sun May 8 09:41:18 CDT 2005


zgrauer at earthlink.net wrote:
>       Keep("
>         <script type="text/javascript"><!--
>          google_ad_client = "pub-9906382443560085";
>          google_ad_width = 180;
>          google_ad_height = 150;
>          google_ad_format = "180x150_as";
>          google_ad_channel ="";
>          google_ad_type = "text";
>          //--></script>")

The error is in this code snippet. Inside of a string delimited with ", 
every " must be escaped with a \, otherwise PHP will think it's the end 
of the string, giving you this sequence of symbols:

   Keep
   (
   " <script type="
   text/javascript
   "><!-- google_ad_client = "
   pub-9906382443560085
   ... etc.

Since text/javascript isn't valid PHP code, this gives syntax errors...

Since the string between Keep(" and ") doesn't contain an PHP variables 
nor any single quotes, the best way to fix the problem would be by 
replacing the double quotes with single quotes like this:

 >       Keep('
 >         <script type="text/javascript"><!--
 >          google_ad_client = "pub-9906382443560085";
 >          google_ad_width = 180;
 >          google_ad_height = 150;
 >          google_ad_format = "180x150_as";
 >          google_ad_channel ="";
 >          google_ad_type = "text";
 >          //--></script>')

HTH

Regards,
Jo



More information about the pmwiki-users mailing list