RonTal Posted June 17, 2009 Share Posted June 17, 2009 I am a complete noobie... Hopefully you can help me figure out what I am doing wrong. I am trying to install a live chat feature (webim) to my online store. I created a new info box (which I have done many times before), and pasted the code I got, but I get the following error: Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/nook/public_html/templates/default/boxes/custom.php on line 39 Here is line 39: 'text' => '<!-- webim button --><a href="/webim/client.php?locale=en" target="_blank" onclick="if(navigator.userAgent.toLowerCase().indexOf('opera') != -1 And here is the entire code: <?php /* Card Infobox, v 1.0 2002/12/04 by Kevin Park osCommerce http://www.oscommerce.com/ Copyright © 2000,2001 osCommerce Released under the GNU General Public License CRE Loaded , Open Source E-Commerce Solutions http://www.creloaded.com Chain Reaction Works, Inc Portions: Copyright © 2005 - 2006 Chain Reaction Works, Inc. Last Modified by $Author$ Last Modifed on : $Date$ Latest Revision : $Revision:$ */ ?> <!-- d Card Info Box //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => '<font color="' . $font_color . '">' . BOX_HEADING_CUSTOM . '</font>' ); new infoBoxHeading($info_box_contents); $info_box_contents = array(); $info_box_contents[] = array('align' => 'center', // 'text' => tep_image(DIR_WS_IMAGES . '/cards/cards.gif') . //elari chanegd to provide a link to your payment acount 'text' => '<!-- webim button --><a href="/webim/client.php?locale=en" target="_blank" onclick="if(navigator.userAgent.toLowerCase().indexOf('opera') != -1 && window.event.preventDefault) window.event.preventDefault();this.newWindow = window.open('/webim/client.php?locale=en&url='+escape(document.location.href)+'&referrer='+escape(document.referrer), 'webim', 'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=640,height=480,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"><img src="/webim/button.php?image=webim&lang=en" border="0" width="163" height="61" alt=""/></a><!-- / webim button -->' ); new infoBox($info_box_contents); if (TEMPLATE_INCLUDE_FOOTER =='true'){ $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => tep_draw_separator('pixel_trans.gif', '100%', '1') ); new infoboxFooter($info_box_contents, '' ); } ?> </td></tr> <!-- d card_eof //--> Thank you in advance! Ronny Quote Link to comment https://forums.phpfreaks.com/topic/162557-parse-error-syntax-error-help/ Share on other sites More sharing options...
RussellReal Posted June 17, 2009 Share Posted June 17, 2009 'text' => '<!-- webim button --><a href="/webim/client.php?locale=en" target="_blank" onclick="if(navigator.userAgent.toLowerCase().indexOf(\'opera\') != -1 try this instead the problem is, you OPEN your string with ', therefore you can't use it INSIDE your string, without escaping it with a \ before it Quote Link to comment https://forums.phpfreaks.com/topic/162557-parse-error-syntax-error-help/#findComment-857956 Share on other sites More sharing options...
RonTal Posted June 17, 2009 Author Share Posted June 17, 2009 Thanks Russell but unfortunately it didn't work :-( I now get this message: Parse error: syntax error, unexpected '=' in /home/nook/public_html/templates/default/boxes/custom.php on line 39 Quote Link to comment https://forums.phpfreaks.com/topic/162557-parse-error-syntax-error-help/#findComment-857963 Share on other sites More sharing options...
Dathremar Posted June 17, 2009 Share Posted June 17, 2009 It is the same thing again. You tend to use singe quotes inside a quoted statement. If You quote something with ' then all the ' used inside should be escaped, like Russel said. So put \ in front of the ' that are inside you command. Quote Link to comment https://forums.phpfreaks.com/topic/162557-parse-error-syntax-error-help/#findComment-857975 Share on other sites More sharing options...
RonTal Posted June 17, 2009 Author Share Posted June 17, 2009 Is this correct then? It didn't work either. I just copied and pasted the code I got for the live chat button and pasted it in between the two ' I had. Any idea? 'text' => '<!-- webim button --><a href="/webim/client.php?locale=en" target="_blank" onclick="if(navigator.userAgent.toLowerCase().indexOf(\'opera\') != -1 && window.event.preventDefault) window.event.preventDefault();this.newWindow = window.open(\'/webim/client.php?locale=en&url='+escape(document.location.href)+\'&referrer=\'+escape(document.referrer), \'webim\', \'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=640,height=480,resizable=1\');this.newWindow.focus();this.newWindow.opener=window;return false;"><img src="/webim/button.php?image=webim&lang=en" border="0" width="163" height="61" alt=""/></a><!-- / webim button -->' ); Quote Link to comment https://forums.phpfreaks.com/topic/162557-parse-error-syntax-error-help/#findComment-857984 Share on other sites More sharing options...
Dathremar Posted June 17, 2009 Share Posted June 17, 2009 try this: 'text' => '<!-- webim button --><a href="/webim/client.php?locale=en" target="_blank" onclick="if(navigator.userAgent.toLowerCase().indexOf(\'opera\') != -1 && window.event.preventDefault) window.event.preventDefault();this.newWindow = window.open(\'/webim/client.php?locale=en&url=\'+escape(document.location.href)+\'&referrer=\'+escape(document.referrer), \'webim\', \'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=640,height=480,resizable=1\');this.newWindow.focus();this.newWindow.opener=window;return false;"><img src="/webim/button.php?image=webim&lang=en" border="0" width="163" height="61" alt=""/></a><!-- / webim button -->' ); And can You tell us what the error says? Install FireBug in Firefox it helps for solving errors Quote Link to comment https://forums.phpfreaks.com/topic/162557-parse-error-syntax-error-help/#findComment-857987 Share on other sites More sharing options...
RonTal Posted June 17, 2009 Author Share Posted June 17, 2009 It worked!!! You are a genius! Thank you so so much!!! Ronny Quote Link to comment https://forums.phpfreaks.com/topic/162557-parse-error-syntax-error-help/#findComment-857993 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.