Difference between revisions of "Template:GetMetaData"

From Pathfinder Wiki
 
(2 intermediate revisions by the same user 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><noinclude>
+
<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>
 
This template returns the value of a parameter as defined in a template on a given honor landing page.  It takes three arguments:
 
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.
 
;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.
Line 10: Line 10:
 
*<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 23:41, 23 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}} →