Youtube – Template

From Bohemia Interactive Community
Jump to navigation Jump to search
(This template requires a plugin not present in this MediaWiki installation. #ev is a parser function used with https://www.mediawiki.org/wiki/Extension:EmbedVideo)
m (Fix description)
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>
<includeonly>{{#if:{{{1|}}}
{{warning|This template requires a plugin not present in this MediaWiki installation. #ev is a parser function used with https://www.mediawiki.org/wiki/Extension:EmbedVideo}}
| <div style="text-align: {{#switch:{{{3|}}}|right=right|center=center|left}}"><div class="thumbinner" style="width: {{{4|300}}}px; display: inline-block">{{#tag:youtube
</noinclude>
| {{{1}}}
| height = {{#expr: ({{{4|300}}} * 9/16) round 0}}
| width = {{{4|300}}}
}}{{#if:{{{2|}}}|<div class="thumbcaption">{{{2}}}</div>}}</div></div>
| -Youtube ID not defined-
}}</includeonly><noinclude>
Shows a {{Link|https://www.youtube.com|YouTube}} video.


<includeonly>
== Usage ==
<div class="tleft" style="clear:none"><div class="thumbinner" style="width:252px;">{{#ev:youtube|{{{1}}}|250}}  <div class="thumbcaption">{{{2|}}}</div></div></div>
{{<nowiki/>Youtube|'''''videoID'''''|'''''caption'''''|'''''position'''''|'''''size'''''}}
{{
* videoID: the ID part of the URL. e.g '''a75eG8HG5Fk'''
#if: {{{3|}}} | <div class="tleft" style="clear:none"><div class="thumbinner" style="width:252px;">{{#ev:youtube|{{{3}}}|250}}  <div class="thumbcaption">{{{4|}}}</div></div></div>
* caption: (optional) caption below the video
}}
* textAlign: (optional, default left) "left", "right" or "center" - does '''not''' use the {{Link|https://developer.mozilla.org/en-US/docs/Web/CSS/float|float}} property
{{
* size: (optional, default 300) width in pixels
#if: {{{5|}}} | <div class="tleft" style="clear:none"><div class="thumbinner" style="width:252px;">{{#ev:youtube|{{{5}}}|250}}  <div class="thumbcaption">{{{6|}}}</div></div></div>
}}
<br clear="both"/>
</includeonly>


<noinclude>[[Category:Templates]]</noinclude>
{| class="wikitable"
|+ Examples
! Code
! style="min-width: 500px" | Result
|-
| <nowiki>{{Youtube}}</nowiki>
| {{Youtube}}
|-
| <nowiki>{{Youtube|a75eG8HG5Fk}}</nowiki>
| {{Youtube|a75eG8HG5Fk}}
|-
| <nowiki>{{Youtube|UgXq6z6-644|{{arma2}} trailer}}</nowiki>
| {{Youtube|UgXq6z6-644|{{arma2}} trailer}}
|-
| <nowiki>{{Youtube|M1YBZUxMX8g|{{arma3}} trailer|right}}</nowiki>
| {{Youtube|M1YBZUxMX8g|{{arma3}} trailer|right}}
|-
| <nowiki>{{Youtube|EwAxJC9AR_A|{{Name|arma3apex}} trailer|center|400}}</nowiki>
| {{Youtube|EwAxJC9AR_A|{{Name|arma3apex}} trailer|center|400}}
|}
 
[[Category:Templates|{{uc:{{PAGENAME}}}}]]</noinclude>

Latest revision as of 12:36, 24 April 2024

Shows a YouTube video.

Usage

{{Youtube|videoID|caption|position|size}}

  • videoID: the ID part of the URL. e.g a75eG8HG5Fk
  • caption: (optional) caption below the video
  • textAlign: (optional, default left) "left", "right" or "center" - does not use the float property
  • size: (optional, default 300) width in pixels
Examples
Code Result
{{Youtube}} -Youtube ID not defined-
{{Youtube|a75eG8HG5Fk}}
{{Youtube|UgXq6z6-644|{{arma2}} trailer}}
Arma 2 trailer
{{Youtube|M1YBZUxMX8g|{{arma3}} trailer|right}}
Arma 3 trailer
{{Youtube|EwAxJC9AR_A|{{Name|arma3apex}} trailer|center|400}}
Arma 3 Apex trailer