Template:LayoutTemplateArgs/doc: Difference between revisions
Template page
More actions
usage and known bugs |
document new "template" parameter |
||
| Line 4: | Line 4: | ||
|1def= | |1def= | ||
|1stat=required | |1stat=required | ||
|2=template | |||
|2d={{en|The name of the template for which these parameters are meant for, without the "Template:" prefix}} | |||
|2def= | |||
|2stat=required | |||
|name=LayoutTemplateArgs | |name=LayoutTemplateArgs | ||
|desc={{en|Helper template for passing parameters to templates using the [[MediaWiki talk:AjaxTranslation.js|Ajax in-line template translation]] feature}} | |desc={{en|Helper template for passing parameters to templates using the [[MediaWiki talk:AjaxTranslation.js|Ajax in-line template translation]] feature}} | ||
| Line 13: | Line 17: | ||
'''Example:'''<br /> | '''Example:'''<br /> | ||
<tt> | <tt> | ||
{{LayoutTemplateArgs|args=<br /> | {{LayoutTemplateArgs|template=FooBar|args=<br /> | ||
{{urlencode: 1={{{1|}}} }}<br /> | {{urlencode: 1={{{1|}}} }}<br /> | ||
{{urlencode: 2={{{2|}}} }}<br /> | {{urlencode: 2={{{2|}}} }}<br /> | ||
| Line 54: | Line 58: | ||
'''Step 2:''' | '''Step 2:''' | ||
Edit the "/layout" subpage and insert <code>{{tl|LayoutTemplateArgs|2=args=...}}</code> ''inside'' the element with the "layouttemplate" class, as early as possible. If the element is a div, you can just put it immediately after the <div> tag; if it's a table, put it at the beginning of the the first table cell. The value of the "args" parameter should contain all the parameters you want to have passed to the translated versions during in-line replacement, ''individually URL-encoded and separated by whitespace'' (i.e. spaces or linebreaks; ''not'' pipes as in normal template calls). For example, if your template takes the same parameters as above, the code you should add to | Edit the "/layout" subpage and insert <code>{{tl|LayoutTemplateArgs|2=template=...|args=...}}</code> ''inside'' the element with the "layouttemplate" class, as early as possible. If the element is a div, you can just put it immediately after the <div> tag; if it's a table, put it at the beginning of the the first table cell. The value of the "args" parameter should contain all the parameters you want to have passed to the translated versions during in-line replacement, ''individually URL-encoded and separated by whitespace'' (i.e. spaces or linebreaks; ''not'' pipes as in normal template calls). For example, if your template takes the same parameters as above, and is named [[Template:FooBar]], the code you should add to [[Template:FooBar/layout]] would be: | ||
<pre> | <pre> | ||
{{LayoutTemplateArgs|args= | {{LayoutTemplateArgs|template=FooBar|args= | ||
{{urlencode: 1={{{1|}}} }} | {{urlencode: 1={{{1|}}} }} | ||
{{urlencode: 2={{{2|}}} }} | {{urlencode: 2={{{2|}}} }} | ||