gally06 Posted August 31, 2013 Share Posted August 31, 2013 Hi guys after some help bit new to php and i am trying to add my twitch video to one of my pages using php coding and i cannot get it done with out getting syntax errors be really grateful of any help with this. <? include("./includes/egl_inc.php"); $out[body].=" <br> <center> <table width='90%' border='0' cellspacing='1' cellpadding='2' bgcolor='#000000'> <tr bgcolor='$config[altcolora]'> <td width='100%' background='$config[bg]' valign='center' align='center' colspan='5'><b>DOA Gaming</b></td> </tr> <tr bgcolor='$config[altcolorb]'> <td width='100%'valign='center' align='center' colspan='5'> echo "<object type="application/x-shockwave-flash" height="378" width="620" id="live_embed_player_flash" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=doa_g4ming" bgcolor="#000000"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" /><param name="flashvars" value="hostname=www.twitch.tv&channel=doa_g4ming&auto_play=true&start_volume=25" /></object><a href="http://www.twitch.tv/doa_g4ming" class="trk" style="padding:2px 0px 4px; display:block; width:345px; font-weight:normal; font-size:10px; text-decoration:underline; text-align:center;">Watch live video from doa_g4ming on www.twitch.tv</a> </tr> </table></center><br /><br /><br /><br />"; include("$config "); ?> Please can someone tell me what is wrong with that coding as to why the video is not showing it is driving me mad Thanks in advance much appreciated Quote Link to comment Share on other sites More sharing options...
.josh Posted August 31, 2013 Share Posted August 31, 2013 well for starters you are improperly quoting things. You use double quotes as your outermost delimiter for the $out[body] string and then proceed to liberally use double quotes in the value without escaping them, so php thinks you are closing the string. You need to either a) escape all of the double quotes (except the starting and ending quotes for the actual variable) b) change the double quotes to single quotes (except the starting and ending quotes) c) use HEREDOC syntax for the variable so you don't have to worry about quotes. Quote Link to comment Share on other sites More sharing options...
gally06 Posted September 1, 2013 Author Share Posted September 1, 2013 Thanks for the reply mate much appreciated i have tried to change the quotations marks but with no success php i am really new too so still learning and this god damn problem is driving me crazy Quote Link to comment Share on other sites More sharing options...
.josh Posted September 1, 2013 Share Posted September 1, 2013 so what are you saying, you don't know how to change all the double quotes to single quotes? Quote Link to comment Share on other sites More sharing options...
gally06 Posted September 1, 2013 Author Share Posted September 1, 2013 Ye i did them but it didnt seem to make a difference wether i changed a few wrong ones or what i not sure but what are you classing as the start and end double quotes in that string Quote Link to comment Share on other sites More sharing options...
gally06 Posted September 1, 2013 Author Share Posted September 1, 2013 Sorry people like me must be a right pain in the ass but still studying all this stuff Quote Link to comment Share on other sites More sharing options...
.josh Posted September 1, 2013 Share Posted September 1, 2013 string example: you have a value and the quotes mark the beginning and end of the value. $myString = "my value";if you want to have quotes in your string: $myString = "she said "hi!" to me"; This won't work because now php thinks the value ended at "she said ". So you can escape the inner quotes: $myString = "she said \"hi!\" to me"; or you can use single quotes: $myString = "she said 'hi!' to me"; or you can use heredoc syntax to mark the beginning and end of the string and not worry about escaping quotes: $myString = <<<EOS she said "hi!" to me another string with 'single' quotes EOS; this makes <<<EOS the beginning delimiter and EOS; the ending delimiter so you can use either or both quotes in your string without having to worry about escaping them. Quote Link to comment Share on other sites More sharing options...
gally06 Posted September 2, 2013 Author Share Posted September 2, 2013 Ok i have tried using the heredoc syntax as you said above and i have got a little closer but not the end result as in i now no longer see error messages about t_string but the page doesnt look quite right. I am putting the <<<EOS before the $out[body].=" bit of my coding and it must be to do with where i close the EOS; in it that i am not doing right where on the coding above would you place these. Really sorry about this being a noob an all, really appreciate you taking the time to help. Quote Link to comment Share on other sites More sharing options...
.josh Posted September 2, 2013 Share Posted September 2, 2013 show what you have tried to do Quote Link to comment Share on other sites More sharing options...
gally06 Posted September 2, 2013 Author Share Posted September 2, 2013 I managed to sus it out now by changing the quatations i had missed one that was on the $out [body].=" so problem solved thanks again for the help much appreciated Quote Link to comment 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.