Wikia

Community Central

Using the youtube extension in an infobox

89,896pages on
this wiki

Forum page

This Forum has been archived

Visit the new Forums
Forums: Index General Discussion Using the youtube extension in an infobox
Wikia's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
Note: This topic has been unedited for 822 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.

Is there a way to embed the youtube extension <youtube width=250 height=30>youtubeid</youtube> in an infobox so you only have to input the id itself, and not the code? What I currently have to do is either a) use the Video Embed Tool to "upload" a video to my wiki, copy the name in the File namespace, and paste it into the infobox, or b) use the youtube extension. The former is tedious and the latter problematic for new users because of the numbers involved (the height restriction is a community-approved stylistic choice for the kind of video the infobox is supposed to be for). So I'd like to design an infobox that has the normal video parameter for both those options, but that also has a 'youtube' parameter where a user only needs to paste the video id. I haven't had much success, unfortunately. I failed completely at getting a second video parameter (called 'youtube') to work even if the first was unspecified; my attempt to get the normal 'video' parameter to accept only the youtube video id failed as well. It looked like this (parameter only):

{{#if: {{{video|}}}|
{{!}}-
{{!}} align="center" colspan="2" style="text-align:center; padding:0.5em;" 
{{!}} <youtube width=250 height=30>{{{video}}}</youtube> <br/>''{{{caption| }}}''
{{!}}-
}}

I searched around a little and found this. Apparently the extension does not tend to play well with templates. So is what I want not doable at all? I had also planned to create parameters for width and height, but I guess that won't work then either. I don't know what to make of the comment in the final section of that talk apge since I've never used those "parser functions". --Tulipclaymore 00:55, April 30, 2012 (UTC)

Try this code instead:
{{#if: {{{video|}}}|
{{!}}-
{{!}} align="center" colspan="2" style="text-align:center; padding:0.5em;" 
{{!}} {{#tag:youtube|{{{video}}}|width=250|height=30}}<br/>''{{{caption| }}}''
{{!}}-
}}
Using that syntax, you can also create parameters for the dimensions i.e. width={{{width}}}|height={{{height}}}. Sovq 05:46, April 30, 2012 (UTC)
Thank you, that does indeed get the video to show up. But I must still be doing something wrong (possibly in the rest of the infobox somewhere). This is your code copied into a "clean" infobox (I removed the other video parameter). This is how it looks (third one; the first one is how it's supposed to look, the second an attempt to copy your code into the normal template, but without the style element). --Tulipclaymore 06:08, April 30, 2012 (UTC)
Template:Infobox_song_yt should work fine now. There was an excess line break causing the problem. Sovq 18:21, April 30, 2012 (UTC)
So it does, and with that help, I also managed to get the combined infobox to work so users can pick either or (or even both) without breaking anything. Thank you very much! --Tulipclaymore 07:33, May 1, 2012 (UTC)

Around Wikia's network

Random Wiki