qtriple Posted June 1, 2009 Share Posted June 1, 2009 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 Link to comment https://forums.phpfreaks.com/topic/160514-solved-syntax-error-unexpected-t_string-tried-everything-but-still-cant-fix-it/ Share on other sites More sharing options...
lonewolf217 Posted June 1, 2009 Share Posted June 1, 2009 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'); Link to comment https://forums.phpfreaks.com/topic/160514-solved-syntax-error-unexpected-t_string-tried-everything-but-still-cant-fix-it/#findComment-847114 Share on other sites More sharing options...
anupamsaha Posted June 1, 2009 Share Posted June 1, 2009 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'); Link to comment https://forums.phpfreaks.com/topic/160514-solved-syntax-error-unexpected-t_string-tried-everything-but-still-cant-fix-it/#findComment-847119 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.