Wiki source for YouTube

Show raw source

====== Embed ""YouTube"" Video ======

This is a simple plugin that enables you to embed a [[ | YouTube]] video into a wiki page.

===== Usage =====
When you view a video at ""YouTube"" there is a small box to the right of the video titled 'About this video'. There is a text box labeled **URL** that contains the URL you can use to share the video with others. NOTE: this plugin uses this URL as it's input - not the URL included in the object/embed tag.

{{youtube url="" [width="425" height="350" bgcolor="#ffffff"]}}

- 'url' is required (see note above)
- 'width' is optional. Defaults to 425 (the standard ""YouTube"" dimensions)
- 'height' is optional. Defaults to 350 (the standard ""YouTube"" dimensions)
- 'bgcolor' is optional. Defaults to white (#ffffff)

===== Install =====
Add youtube.php to the actions folder of your Wikka install.

===== Code =====

YouTube plugin created by Grant Young for WWF-Australia.

USE: {{youtube url="" [width="425" height="350" bgcolor="#ffffff"]}}

'url' must be provided, and is the URL specified in the 'About this video' section next to the video.
'width', 'height' and 'bgcolor' are all optional. Defaults are listed above.

if (!($url)) {
print "<strong>You must provide the YouTube url, including 'http://'.</strong>";
} else {
if (!$width)
$width = 425;
if (!$height)
$height = 350;
if (!$bgcolor)
$bgcolor = "#ffffff";

// - if URL in this format, need to change to /v/LvU6UFF1_MA
$ptn = "/watch\?v=([A-Za-z0-9_\-]{11})$/";
if (preg_match($ptn, $url, $matches))
$id = $matches[1];
print "<strong>The provided URL was not in the correct format.</strong>";

print '<object type="application/x-shockwave-flash" data="'.$id.'" width="'.$width.'" height="'.$height.'" id="VideoPlayback">
<param name="movie" value="'.$id.'" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="quality" value="best" />
<param name="bgcolor" value="'.$bgcolor.'" />
<param name="scale" value="noScale" />
<param name="FlashVars" value="playerMode=embedded" />

Valid XHTML :: Valid CSS: :: Powered by WikkaWiki