Jump to content

Help With Adding Vids


gally06

Recommended Posts

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  :happy-04:
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.