Jump to content

Youtube embed help


dc_jt

Recommended Posts

Hi

 

Can someone please help me with the following. I have a content area where I can add content and I want to embed a youtube video within the content. I am trying to do it so that if I type [youtube: http://www....com] then I can use preg_replace to get the embed code.

 

Currently Im using the following function:

 

return preg_replace('/\[youtube: ([^\]]+?)\]/', '<object width="560" height="340"><param name="movie" value="\\1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="\\1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>', $body);

 

However this returns it in an incorrect format. I need to convert it from

to
=en&fs=1&

 

Can anyone help?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/171797-youtube-embed-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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