Forum:(Solved) YouTube extension doesn't work when used through template

ShoutWiki — express yourself and be heard!
Jump to navigation Jump to search
Forums: Index > Community help

I created a simple template to replicate additional functionality on some specific wiki pages (like this one), but now when I used it for embeding YouTube videos, the extension won't accept the video ID code. How can I fix this?

Also, as a side question, how do you guys (girls?) are testing templates before actually saving them? I tried previewing the code on the same template page I wanted to create, while putting the {{TemplateName|variable=input}} at the end of page to test it directly, but that didn't worked. The only thing that comes close (and I'm aware of) is to create a working code, then replace the required parts with variables before saving, but this doesn't necessarily mean a working code, as shown in the above example. --MYself (talk) 10:39, 8 March 2014 (UTC)

You need to call the extension as a parser function instead of a tag, i.e. {{#tag:youtube|id={{{id}}}}}, if and when you need to pass variables to the extension. A longer and more technical explanation as to why this is needed can be found on MediaWiki.org. --Jack PhoenixShoutWiki Staff (Contact) 19:29, 14 March 2014 (UTC)
This is a great news for me, thank you a hundred times Jack! I seriously doubted that this is in fact possible, so I was forced to remove this function just to bring it back today. To inform the future Googlers that might stumble upon this forum topic, the correct solution here is {{#tag:youtube|{{{id}}}}} (without the extra id=). --MYself (talk) 13:34, 15 March 2014 (UTC)