Jump to content

Template:Template parameter value/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Aidan9382 (talk | contribs) at 11:10, 3 March 2023 (Template data: wording changes). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Usage

The purpose of this template is to gain the value of a template's parameter (named or numbered) in an article, for usage elsewhere. For example, gaining the value of the |num_episodes= parameter in the {{Infobox television}} template in an article, to use in another article.

This template works with named or numbered parameters; i.e. it can get the first parameter of {{Start date}} (the year). This template is case-sensitive; i.e. setting |Viewers= will not match |viewers=. Make sure that you are listing the article where the template exists, not where it's transcluded to.

Basic Syntax

{{Template parameter value|ARTICLE|TEMPLATE|TEMPLATE-COUNT|PARAMETER|PARAMETER-COUNT}}

Examples

24th usage of |OriginalAirDate= in the 3rd usage of {{Episode table}} in List of Lucifer episodes
{{Template parameter value|List of Lucifer episodes|Episode table|3|OriginalAirDate|24}}
May 14, 2018 (2018-05-14)
2nd usage of |archiveurl= in the 1st usage of {{Series overview}} in List of Agents of S.H.I.E.L.D. episodes
{{Template parameter value|List of Agents of S.H.I.E.L.D. episodes|Series overview||archiveurl|2}}
1st usage of |LineColor= in the 2nd usage of {{Episode list/sublist}} in Vikings (season 4)
{{Template parameter value|Vikings (season 4)|Episode list/sublist|2|LineColor}}
1st usage of |num_episodes= in the 1st usage of {{Infobox television}} in 12 Monkeys (TV series)
{{Template parameter value|12 Monkeys (TV series)|Infobox television||num_episodes}}
47
3rd parameter in the 8th usage of {{Start date}} in The Big Bang Theory
{{Template parameter value|The Big Bang Theory|Start date|8|3}}
26

Module usage

The module can be used directly for other modules through the function getValue(page, templates, parameters, options), which will return a success boolean and either why it failed or the resulting parameter value.

page, templates, and parameters are all required arguments. options is an optional table which can have the values templateIndex, parameterIndex, and ignoreSubtemplates (see the Template data for reference)

Template data

A template to grab the value of parameters from templates on a page

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Page1

The page to grab templates from

Page namerequired
Templates2

The templates to look for in the target page. Can be provided in a comma split list to check for multiple templates

Stringrequired
Template index3

Which occurance of the template to check for parameters in

Numberoptional
Parameter4

The name of the parameter to check for

Stringrequired
Parameter index5

Which occurance of the parameter to check for in the template. Does not apply if "Ignore subtemplates" is used

Numberoptional
Ignore subtemplatesignore_subtemplates ist

Giving this a value will make the template ignores subtemplates and their parameters when looking for a value in a template. Can be used for more precise grabbing of parameters as opposed to using a parameter index

Booleanoptional

See also

  • {{get parameter}}, another template doing the same thing with a different set of limitations