Help:Named args
From semantic-mediawiki.org
Example[edit]
The query at Demo:Examples/Queries/Template_to_display_random_videos has the parameter named args=yes
:
{{#ask: [[Has video provider::Vimeo||YouTube]] |?Has video provider |?Has video id |?Has description |limit=6 |link=none |order=random |sort=Has video id |named args=yes |format=template |template=AskWidgetVideoList |introtemplate=AskWidgetVideoListIntro |outrotemplate=AskWidgetVideoListOutro |searchlabel= ... find more videos here }}
It uses the template Template:AskWidgetVideoList where the selected properties
from the ask query can now be used as template parameters, e.g. {{{Has video provider}}}
.
Please note that in SMW versions prior to 3.0 the parameter names had a question mark prepended, so
{{{?Has video provider}}}
has to be used.
Migrating Templates using ? prepended Named Args to SMW Version > 3.0[edit]
Having the ReplaceText extension installed, you could simply visit Special:ReplaceText and replace all occurrences of {{{?
by {{{
, selecting the Template namespace.
(see SMW issue 4315).