Jump to content

[SOLVED] syntax error, unexpected T_STRING, Tried everything but still can't fix it!!


qtriple

Recommended Posts

I have the code pretty much written but need some help figuring out the syntex error that I am receiving.

 

I am trying to set up google section targeting in my blog with a custom function so that my google ads are automatically inserted w/in the section targeted area.

 

Here is the section targeting code:

 

//adsense targeting functions

function open_adsense_targting(){

echo "<!-- google_ad_section_start -->";

}

function close_adsense_targting(){

echo "<!-- google_ad_section_end -->";

}

add_action('thesis_hook_before_post','open_adsense_targting');

add_action('thesis_hook_after_post', 'close_adsense_targting');

 

The section targeting is working.  as confirmed by my view page source

???

Below is the portion is am having problems with.

 

//this appears under the author byline

function uauthor_byline(){echo "<script type="text/javascript"><!--

google_ad_client = "pub-xxxxxxxxxxxxxxxxx";

/* 468x60, created 5/31/09 */

google_ad_slot = "xxxxxxxxxxx";

google_ad_width = 468;

google_ad_height = 60;

//-->

</script>

<script type="text/javascript"

src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

</script>";

}

add_action('thesis_hook_before_post','uauthor_byline');

 

I am now getting this error:

 

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in custom_functions.php on line 44

use a script editor and you can see that your quotes aren't escaped properly

 

<?php
//this appears under the author byline
function uauthor_byline(){echo "<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxxxxxxxx";
/* 468x60, created 5/31/09 */
google_ad_slot = "xxxxxxxxxxx";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>";
}
add_action('thesis_hook_before_post','uauthor_byline');

Try this:

 

<?php
//this appears under the author byline
function uauthor_byline(){echo "<script type=\"text/javascript\"><!--
google_ad_client = \"pub-xxxxxxxxxxxxxxxxx\";
/* 468x60, created 5/31/09 */
google_ad_slot = \"xxxxxxxxxxx\";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type=\"text/javascript\"
src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">
</script>";
}
add_action('thesis_hook_before_post','uauthor_byline');

 

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.