Hey, I am trying to allow the users of my website to embed youtube videos by only providing the link. I need it so that if no link is provided that the rest of the embed code is not displayed. I have limited PHP knowledge and im seeking help. The site runs on wordpress. This is what ive got so far: <?php $embed = $value = get_post_meta($post->ID, "embed", true); if ($embed == NULL) { echo ''; } else { echo '<object width="425" height="344"><param name="movie" value="$embed&hl=en&fs=1&color1=0xe1600f&color2=0xfebd01"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="$embed=en&fs=1&color1=0xe1600f&color2=0xfebd01" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>'; } ?> PHP: I do not understand how to add the $embed inside the code. If anyone could help me it would be greatly appreciated. Thanks, Jonny
Without seeing all of your code I'm not positive but I think this is what you are trying to do <?php $embed = get_post_meta($post->ID, "embed", true); if ($embed == NULL) { echo ''; } else { echo '<object width="425" height="344"><param name="movie" value="$embed&hl=en&fs=1&color1=0xe1600f&color2=0xfebd01"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="$embed=en&fs=1&color1=0xe1600f&color2=0xfebd01" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>' ; } ?> PHP:
You have cleaned it up but you missed the bit I need help with You see the "<object width=...>"? Where it says "Value=" I was trying to put the $embed so it displays the link from the "get_post_meta..." Hope that makes it clearer. Thanks, Jonny