Content deleted Content added
→Examples: Be specific about the checked template |
Revamp of docs following major module update |
||
Line 1:
{{Documentation subpage}}
{{Shortcut|Template:Tmpv}}
{{Lua|Module:Template parameter value}}
Line 15 ⟶ 10:
This template works with named or numbered parameters; i.e. it can get the first parameter of {{tl|Start date}} (the year). This template is case-sensitive; i.e. setting {{para|Viewers}} will not match {{para|viewers}}. Make sure that you are listing the article where the template exists, not where it's transcluded to.
=== Basic Syntax ===
: <code><nowiki>{{Template parameter value|ARTICLE|TEMPLATE|TEMPLATE-COUNT|PARAMETER|PARAMETER-COUNT}}</nowiki></code>
Line 39 ⟶ 34:
: {{Template parameter value|The Big Bang Theory|Start date|8|3}}
===
The module can be used directly for other modules through the function <code>getValue(page, templates, parameters, options)</code>, which will return a success boolean and either why it failed or the resulting parameter value.
<code>page</code>, <code>templates</code>, and <code>parameters</code> are all required arguments. <code>options</code> is an optional table which can have the values <code>templateIndex</code>, <code>parameterIndex</code>, and <code>ignoreSubtemplates</code> (see the Template data for reference)
<templatedata>
{
"params": {
"1": {
"label": "Page",
"description": "The page to grab templates from",
"type": "wiki-page-name",
"required": true
},
▲| Template
"2": {
"label": "Templates",
"description": "The templates to look for in the target page. Can be provided in a comma split list to check for multiple templates",
"type": "string",
"required": true
},
"3": {
"label": "Template index",
"description": "Which occurance of the template to check for parameters in",
"type": "number"
},
"4": {
"description": "The name of the parameter to check for",
"type": "string",
"required": true
},
"5": {
"label": "Parameter index",
"description": "Which occurance of the parameter to check for in the template. Does not apply if \"ignore_subtemplates\" is used",
"type": "number"
"ignore_subtemplates": {
"aliases": [
"ist"
],
"label": "Ignore subtemplates",
"description": "Ignores subtemplates and their parameters when looking for a value in a template. Can be used to increase the precision of the grabbing as opposed to using Parameter index",
"type": "boolean"
}
},
"description": "A template to grab the value of parameters from templates on other pages",
"format": "inline"
}</templatedata>
== See also ==
* {{tl|get parameter}}, another template doing the same thing with a different set of limitations
|