EllisLab text mark
Advanced Search
     
New Plugin: YouTubee
Posted: 30 August 2009 09:41 AM   [ Ignore ]
Avatar
Joined: 2006-01-14
350 posts

Hi there,

I’ve just whipped up a quick plugin that allows you to embed YouTube clips into your templates by just passing a url…

Simply create a custom field to hold a YouTube clip url eg: http://www.youtube.com/watch?v=YiefzD2J1_U, and wrap the field output in the following code:

{exp:youtubee width="480" height="340"}{your_field}{/exp:youtubee} 

The code it produces is Valid xhtml sourced from here so Hat-Tip to that man.

Parameters are just width and height, allowing you to place your clips around your site in different sizes without having to tweak multiple embed codes.

You can download from Jam Digital

Enjoy.

 Signature 

Weblog | @iain | Taxonomy for EE2

 
Posted: 30 August 2009 11:45 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-19
201 posts

Thanks ill check this out now

 Signature 

I design, I blog, and I Twitter

 
Posted: 30 August 2009 11:59 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-19
201 posts

I get Parse error: parse error, unexpected ‘&’, expecting T_VARIABLE or ‘$’ in /www/pmh4395/public_html/admin/plugins/pi.youtubee.php on line 44 when installed.

 Signature 

I design, I blog, and I Twitter

 
Posted: 30 August 2009 12:06 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2006-01-14
350 posts

try removing the ampersand on line 44

change:

foreach ($matches as &$match

to

foreach ($matches as $match

I’m guessing you’re running php4?

 Signature 

Weblog | @iain | Taxonomy for EE2

 
Posted: 30 August 2009 12:08 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2006-01-14
350 posts

I should just remove that for each loop anyway… I initially wanted to replace several YouTube urls at once but gave up quickly as it wasn’t a requirement.

 Signature 

Weblog | @iain | Taxonomy for EE2

 
Posted: 30 August 2009 12:16 PM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-19
201 posts

Thanks I have it all working now, such a great plug-in for what I needed and just at the right time.

 Signature 

I design, I blog, and I Twitter

 
Posted: 30 August 2009 12:21 PM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Avatar
Joined: 2006-01-14
350 posts

You’re welcome smile Glad you found it useful.

 Signature 

Weblog | @iain | Taxonomy for EE2

 
Posted: 30 August 2009 12:22 PM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-19
201 posts

Yes I did thanks.

If you want to see it used its used on http://mondaymorninginsight.com/ on the left hand side and also click the link and its used again.

 Signature 

I design, I blog, and I Twitter

 
Posted: 16 October 2009 05:57 PM   [ Ignore ]   [ # 8 ]   [ Rating: 0 ]
Avatar
Joined: 2007-05-11
211 posts

the code may be valid, but it doesn’t work in IE-you need the <embed> code as well.

 
Posted: 13 November 2009 03:07 AM   [ Ignore ]   [ # 9 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-19
47 posts

Just want to say “thank you” for writing this.  Perfect timing for me too.

 Signature 

Amy Stoddard
http://www.amystoddard.com
Bundang, South Korea

 
Posted: 13 November 2009 07:38 AM   [ Ignore ]   [ # 10 ]   [ Rating: 0 ]
Avatar
Joined: 2008-06-26
262 posts

I can’t get Youtubee to work. Seems to be a problem with the custom field I’m using to place the YouTube link between the YouTubee tags… or maybe not.

My template code is set up like this

{exp:youtubee width="480" height="295"}{videolink}{/exp:youtubee} 

Its generating the right embed code on the front of the site, except for the actual video link itself. Im getting…

data="http://www.youtube.com/v/KIfRgFtDkC8</a>&amp;hl=en" 

Notice the extra…

"</a>&amp;hl=en" 

...at the end of the link. I don’t know where this is coming from. My custom field is set to text input, no formatting, so it can’t be that, can it?

Thanks for any suggestions!
Nik

 Signature 

nickfoxall.com | ExpressionEngine Development in Hong Kong

 
Posted: 13 November 2009 09:17 AM   [ Ignore ]   [ # 11 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-19
47 posts

Do you have “Automatically Create Links from URLs” turned off in the weblog (channel) preferences?  It should be turned off.

 Signature 

Amy Stoddard
http://www.amystoddard.com
Bundang, South Korea

 
Posted: 13 November 2009 10:50 AM   [ Ignore ]   [ # 12 ]   [ Rating: 0 ]
Avatar
Joined: 2008-06-26
262 posts

Aha!! i **knew** it would be something like that. Works now!

Thanks Amy!

 Signature 

nickfoxall.com | ExpressionEngine Development in Hong Kong