: In MediaWiki templates how to show empty default value In a MediaWiki template I'm making, I want to let it to become [[CODE-value]] when CODE=value is used and empty when CODE=value is not
In a MediaWiki template I'm making, I want to let it to become [[CODE-value]] when CODE=value is used and empty when CODE=value is not given in the actual page. The current version
[[CODE-{{{CODE|}}}|{{{CODE|}}}]]
fails the second requirement. Any ideas?
More posts by @Heady270
1 Comments
Sorted by latest first Latest Oldest Best
Make sure the ParserFunctions extension is installed.
Then put the following in a template, such as Template:Iftest
{{#if: {{{CODE|}}} | [[CODE-{{{CODE}}}]] | (not applicable) }}
If CODE-parameter is empty or not present you get (not applicable). i.e.
{{Iftest|CODE=123}} gives [[CODE-123]]
{{Iftest|CODE=}} gives (not applicable)
{{Iftest}} gives (not applicable)
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.