Template:EmbedVideo: Difference between revisions

Using a variable to reduce the mess
(Using this template to generate the global documentation because it doesn't do anything, only show the embedvideo plugin usage. So, I can use it to generate the global documentation and showing plugin usage together ;D [WIP stage!])
(Using a variable to reduce the mess)
Line 1: Line 1:
<includeonly>This template provides a simplified way to use the [[Template:EmbedVideo|EmbedVideo]] plugin. It automatically uses the standard thumbnail size and position used on this wiki
<includeonly>This template provides a simplified way to use the [[Template:EmbedVideo|EmbedVideo]] plugin. It automatically uses the standard thumbnail size and position used on this wiki
 
{{#vardefine:servicename|{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}}}
==Usage==
==Usage==
The {{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}} template should be called in the following way:
The {{#var:servicename}} template should be called in the following way:
*<code><nowiki>{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|<videoID>|<title>|<options>}}</nowiki></code>
*<code><nowiki>{{{{#var:servicename}}|<videoID>|<title>|<options>}}</nowiki></code>
where
where
*<code>Video ID</code> is the ID is the bold part of the URL (<nowiki>http://www.youtube.com/watch?v=</nowiki>'''VqNcksMfAjM''')
*<code>Video ID</code> is the ID is the bold part of the URL (<nowiki>http://www.youtube.com/watch?v=</nowiki>'''VqNcksMfAjM''')
*<code>Title</code> (optional) is the caption for the video
*<code>Title</code> (optional) is the caption for the video
*<code>options</code> (optional) control some other functionalities of this template. Specifying <code>br</code> in this parameter tell the template to create a new row after embedding the video. Specifying <code>link</code> makes the template return only a hiperlink to watch the video on {{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}.
*<code>options</code> (optional) control some other functionalities of this template. Specifying <code>br</code> in this parameter tell the template to create a new row after embedding the video. Specifying <code>link</code> makes the template return only a hiperlink to watch the video on {{#var:servicename}}.


==Examples==
==Examples==
* Embed a video by specifying video ID and title. Titles longer than the box will automatically be truncated. We are embedding only one video, so we should add the <code>br</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro with title longer than box|br}}</nowiki></code> will produce this:
* Embed a video by specifying video ID and title. Titles longer than the box will automatically be truncated. We are embedding only one video, so we should add the <code>br</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro with title longer than box|br}}</nowiki></code> will produce this:
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro with title longer than box|br}}
{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro with title longer than box|br}}


* Embed a video by specifying only video ID, so the 2nd parameter is null. We are embedding only one video, so we should add the <code>br</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM||br}}</nowiki></code> make the template use URL as title since no title was entered:
* Embed a video by specifying only video ID, so the 2nd parameter is null. We are embedding only one video, so we should add the <code>br</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#var:servicename}}|vimeo=Vimeo}}|VqNcksMfAjM||br}}</nowiki></code> make the template use URL as title since no title was entered:
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM||br}}
{{{{#var:servicename}}|VqNcksMfAjM||br}}


* Return a hiperlink to watch the video on {{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}} by specifying video ID and title. We want only the hiperlink, so we should add the <code>link</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|link}}</nowiki></code> will produce this:
* Return a hiperlink to watch the video on {{#var:servicename}} by specifying video ID and title. We want only the hiperlink, so we should add the <code>link</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|link}}</nowiki></code> will produce this:
:{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|link}}
:{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|link}}




* Return a hiperlink to watch the video on {{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}} by specifying only video ID. We want only the hiperlink, so we should add the <code>link</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM||link}}</nowiki></code> make the template use URL as title since no title was entered:
* Return a hiperlink to watch the video on {{#var:servicename}} by specifying only video ID. We want only the hiperlink, so we should add the <code>link</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#var:servicename}}|VqNcksMfAjM||link}}</nowiki></code> make the template use URL as title since no title was entered:
:{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM||link}}
:{{{{#var:servicename}}|VqNcksMfAjM||link}}


==Notes==
==Notes==
* To use only video ID and an option, you must null the 2nd parameter by using ||, like this: <code><nowiki>{{YouTube|<videoID>||<options>}}</nowiki></code>
* To use only video ID and an option, you must null the 2nd parameter by using ||, like this: <code><nowiki>{{{{#var:servicename}}|<videoID>||<options>}}</nowiki></code>
* The 3rd parameter only accept one option. If you include more than one option, none of them will work.
* The 3rd parameter only accept one option. If you include more than one option, none of them will work.
* Using multiple calls will make the videos be side-by-side (the last video should ALWAYS include the <code>br</code> tag to the 3rd parameter):
* Using multiple calls will make the videos be side-by-side (the last video should ALWAYS include the <code>br</code> tag to the 3rd parameter):
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro}}
{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro}}
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro}}
{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro}}
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|br}}
{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|br}}


* When you need one video in each row, you should add the <code>br</code> tag to the 3rd parameter of all videos, not just the last:
* When you need one video in each row, you should add the <code>br</code> tag to the 3rd parameter of all videos, not just the last:
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|br}}
{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|br}}
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|br}}
{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|br}}
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro}}
{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro}}


* If you use this template and forget to add the <code>br</code> tag to the 3rd parameter after calling the last video, you'll get something weird, like this topic!</includeonly><noinclude>
* If you use this template and forget to add the <code>br</code> tag to the 3rd parameter after calling the last video, you'll get something weird, like this topic!</includeonly><noinclude>
{{documentation}}</noinclude>
{{documentation}}</noinclude>