Difference between revisions of "Template:GetMetaData"

From Pathfinder Wiki
(Created page with "<includeonly>{{#vardefine:page|{{{page|{{#if:{{{honor|}}}|AY Honors/{{{honor}}}|{{#titleparts:{{PAGENAME}}|2}}}}}}}}}{{#vardefine:srcpage|{{#if:{{#explode:{{#var:page}}|(|1}}}...")
 
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#vardefine:page|{{{page|{{#if:{{{honor|}}}|AY Honors/{{{honor}}}|{{#titleparts:{{PAGENAME}}|2}}}}}}}}}{{#vardefine:srcpage|{{#if:{{#explode:{{#var:page}}|(|1}}}|{{#explode:{{#var:page}}|(|0}}|{{#var:page}}}}}}{{#vardefine:landingpage|{{#titleparts:{{#var:srcpage}}|2}}}}{{#dpl:title={{#var:landingpage}}|include={{{{template|HonorLanding}}}}:{{{parameter|honorname}}}}}
+
<includeonly>{{#vardefine:page|{{{page|{{#if:{{{honor|}}}|AY Honors/{{{honor}}}|{{GetHonorLandingPage}}}}}}}}}{{#vardefine:srcpage|{{#if:{{#explode:{{#var:page}}|(|1}}}|{{#explode:{{#var:page}}|(|0}}|{{#var:page}}}}}}{{#vardefine:landingpage|{{#titleparts:{{#var:srcpage}}|2}}}}{{#dpl:title={{#var:landingpage}}|include={{{{template|HonorLanding}}}}:{{{parameter|honorname}}}}}</includeonly><noinclude>
*{{#var:srcpage}}
+
This template returns the value of a parameter as defined in a template on a given honor landing page.  It takes three arguments:
*{{#var:landingpage}}
+
;page|honor: You can specify either the page or the honor.  If you specify both it will use page.  The page argument is the page title of an honor or one of its subpagesIt accepts translated pages, but ignores that since the metadata is in the honor's "source" page which is in English.  This could give problems when trying to fetch an honorname.  If you need the translated version of any other parameter, you should be able to use [[:Template:Localize]] to convert it.
</includeonly>
+
;template: If omitted, this will specify which template holds the parameter you want.  It defaults to HonorLanding, but if you are experimenting and have some other template in place, you can specify it.
<noinclude>
+
;parameter: This specifies which parameter of template you want the template to return.  It will always return the English value of the parameter.  Again... [[:Template:Localize]] is your friend, but note that Localize only works on a translate page (or we'd demonstrate it here).
This template returns the page title of an honor's main landing page.  It accepts a page argument which can be any subpage of an honor, and it can also be any variant of an honor.  If no page argument is given, it can accept an honor insteadIf neither a page nor an honor argument is supplied, the template will assume it is being invoked from an honor page or subpage.
 
 
 
The page the template returns is the master source of metadata for the honor.
 
  
 +
==Examples==
 
*<nowiki>{{</nowiki>GetMetaData|page=AY Honors/Cycling/Requirements|parameter=category}} &rarr; {{GetMetaData|page=AY Honors/Cycling/Requirements|parameter=category}}
 
*<nowiki>{{</nowiki>GetMetaData|page=AY Honors/Cycling/Requirements|parameter=category}} &rarr; {{GetMetaData|page=AY Honors/Cycling/Requirements|parameter=category}}
 
*<nowiki>{{</nowiki>GetMetaData|page=AY Honors/Cycling/Requirements/es|parameter=skill}} &rarr; {{GetMetaData|page=AY Honors/Cycling/Requirements/es|parameter=skill}}
 
*<nowiki>{{</nowiki>GetMetaData|page=AY Honors/Cycling/Requirements/es|parameter=skill}} &rarr; {{GetMetaData|page=AY Honors/Cycling/Requirements/es|parameter=skill}}
 
*<nowiki>{{</nowiki>GetMetaData|honor=Camping Skills III|parameter=authority}} &rarr; {{GetMetaData|honor=Camping Skills III|parameter=authority}}
 
*<nowiki>{{</nowiki>GetMetaData|honor=Camping Skills III|parameter=authority}} &rarr; {{GetMetaData|honor=Camping Skills III|parameter=authority}}
 
*<nowiki>{{</nowiki>GetMetaData|honor=Animal Tracking (General Conference)|parameter=year}} &rarr; {{GetMetaData|honor=Animal Tracking (General Conference)|parameter=year}}
 
*<nowiki>{{</nowiki>GetMetaData|honor=Animal Tracking (General Conference)|parameter=year}} &rarr; {{GetMetaData|honor=Animal Tracking (General Conference)|parameter=year}}
 +
*<nowiki>{{</nowiki>GetMetaData|honor=Currency|parameter=year|template=User:DesignerThan/Sandbox/LandingPage}} &rarr; {{GetMetaData|honor=Currency|parameter=year|template=User:DesignerThan/Sandbox/LandingPage}}
  
  
 
</noinclude>
 
</noinclude>

Latest revision as of 00:41, 24 March 2021

This template returns the value of a parameter as defined in a template on a given honor landing page. It takes three arguments:

page|honor
You can specify either the page or the honor. If you specify both it will use page. The page argument is the page title of an honor or one of its subpages. It accepts translated pages, but ignores that since the metadata is in the honor's "source" page which is in English. This could give problems when trying to fetch an honorname. If you need the translated version of any other parameter, you should be able to use Template:Localize to convert it.
template
If omitted, this will specify which template holds the parameter you want. It defaults to HonorLanding, but if you are experimenting and have some other template in place, you can specify it.
parameter
This specifies which parameter of template you want the template to return. It will always return the English value of the parameter. Again... Template:Localize is your friend, but note that Localize only works on a translate page (or we'd demonstrate it here).

Examples

  • {{GetMetaData|page=AY Honors/Cycling/Requirements|parameter=category}} → Recreation
  • {{GetMetaData|page=AY Honors/Cycling/Requirements/es|parameter=skill}} → 1
  • {{GetMetaData|honor=Camping Skills III|parameter=authority}} → General Conference
  • {{GetMetaData|honor=Animal Tracking (General Conference)|parameter=year}} → 1976
  • {{GetMetaData|honor=Currency|parameter=year|template=User:DesignerThan/Sandbox/LandingPage}} →