Embedding youtube videos using an EasyMacro

  • Tip Category - Developing Wiki Applications
  • Tip Added By - MichaelDaum - 24 Oct 2011 - 10:52
  • Extensions Used - EasyMacroPlugin
  • Useful To - Beginners
  • Tip Status - New
  • Related Topics -

Problem

Instead of copy-pasting html <embed ...> code all over your wiki, here's a simple wiki app that does this all in one place.

Context

Solution

Save the below to a topic called SomeWeb.EasyYoutube. Then add this web.topic to the EASYMACROS variable of your Main.SitePreferences.

%STARTSECTION{"registration"}%
%REGISTERMACRO{"YOUTUBE" param="VIDEO"}%
%ENDSECTION{"registration"}%

%STARTINCLUDE%<object \
  %IF{"$SIZE='small' or not defined SIZE" then="width='425' height='344'"}%\
  %IF{"$SIZE='medium'" then="width='480' height='385'"}%\
  %IF{"$SIZE='large'" then="width='640' height='505'"}%\
  %IF{"$SIZE='huge'" then="width='960' height='745'"}%>
  <param name="movie" value="http://www.youtube.com/v/%VIDEO%&fs=1></param>
  <param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>
  <embed src="http://www.youtube.com/v/%VIDEO%&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" \
  %IF{"$SIZE='small'" then="width='425' height='344'"}%\
  %IF{"$SIZE='medium' or not defined SIZE" then="width='480' height='385'"}%\
  %IF{"$SIZE='large'" then="width='640' height='505'"}%\
  %IF{"$SIZE='huge'" then="width='960' height='745'"}%>
  </embed>
</object>%STOPINCLUDE%

Parameters

  • SIZE: small, medium, large, huge

Test

You type:
%YOUTUBE{"Ddn4MGaS3N4"}%

You get (if installed):

%YOUTUBE{"Ddn4MGaS3N4"}%

Known Uses

Known Limitations

See Also

BestPracticeTipsForm edit

Category Developing Wiki Applications
Related Topics
Topic revision: r1 - 24 Oct 2011, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy