Help:DPL using templates

From Ballotpedia
(Redirected from Help:Fixed wiki variables)
Jump to: navigation, search
Ballotpedia:WikiProject Help

Template transclusion is a key feature of most wiki pages. Examples of common features are horizontal navigational templates on the bottom of a page, a complex infobox on a judge page, or a template designed to incorporate key categories on a page. This page will highlight the various uses of template transclusion on the wiki and some tips and tricks for expanding your ability to include templates in DPLs.

Other help pages

Template transclusion

Templates, or parts of templates, can be included in DPL results, using the "include" line.

An entire template can be included by specifying the template but not specifying a parameter to include. This can be particularly useful in comparing templates across a number of pages for similarities and consistency. The code to include it would be the following:

Example:  Whole Template Transclusion
Code:  
{{#dpl:
|title = Jeffrey R. Howard
|ordermethod = firstedit
|include = {Judge infobox}
|format = ,[[%PAGE%]],,
}}
Description:  
Will produce a single item list including the page with the title “Jeffrey R. Howard” and incorporating the template Template:Judge infobox.
Example:  

Extension:DynamicPageList (DPL), version 2.01 : Warning: No results.


Reference sections

This tool can be particularly useful for pulling the reference section on a page by pulling the reflist template from that page. When used in combination with transcluding section headings, you are able to incorporate the references within those headings just below the appropriate section.

Example:  Section and Reference transclusion
Code:  
{{#dpl:
|title = Jeffrey R. Howard
|ordermethod = firstedit
|include = #Professional career, {reflist}
|format = ,[[%PAGE%]],,
}}
Description:  
Will produce a single item list including the page with the title “Jeffrey R. Howard” and incorporating the section "Professional career" and the template Template:Reflist.
Example:  

Extension:DynamicPageList (DPL), version 2.01 : Warning: No results.


Transcluding parts of templates

Individual portions of templates can be transcluded using the include statement and specifying both the template name and the parameter you wish to call. Note that without proper formatting, template parameters appear stacked on one another with no spacing. More formatting instructions can be found on this page.

Example:  Parameter transclusion
Code:  
{{#dpl:
|title = Jeffrey R. Howard
|ordermethod = firstedit
|include = {Judge infobox}:Lastname,{Judge infobox}:Law
|format = ,[[%PAGE%]],,
}}
Description:  
Will produce a single item list including the page with the title “Jeffrey R. Howard” and incorporating the parameters "Lastname" and "Law" from the template Template:Judge infobox.
Example:  

Extension:DynamicPageList (DPL), version 2.01 : Warning: No results.


Transcluding from different templates

You can transclude information from different templates on the same page using the same method that you transclude two parameters from the same template.

Example:  Parameter transclusion
Code:  
{{#dpl:
|title = Jeffrey R. Howard
|ordermethod = firstedit
|include = {Judge infobox}:Lastname,{Succession box}:before
|format = ,[[%PAGE%]],,
}}
Description:  
Will produce a single item list including the page with the title “Jeffrey R. Howard” and incorporating the parameters "Lastname" from the template Template:Judge infobox and the parameter "before" from the template Template:Succession box (which indicates who the judge was preceded by).
Example:  

Extension:DynamicPageList (DPL), version 2.01 : Warning: No results.


Putting it all together

Example:  Multiple component transclusion with complex formatting line.
Code:  
{{#dpl:
|category = Federal judge, First Circuit
|notnamespace = Category
|count = 3
|ordermethod = firstedit
|addeditdate = true
|addauthor= true
|addpagecounter= true
|include = {Judge infobox}:Court,%1,##.*Professional.*,{reflist}
|format = <center>This is a list of former federal judges:</center><hr>,\n'''Judge [[%PAGE%{{!}}%TITLE%]]''',The page has %COUNT% hits and was created by %USER%. ,<br/><center>List completed!</center>
}}
Description:  
Will produce a list including the top 3 hits from the category "Federal judge, First Circuit" and pulls the parameter "Court" from the template Template:Judge infobox, the first section, all sections with "professional" in the heading and the Template:Reflist template. It also pulls the metadata, including the total number of hits and the user who started the page. The count is limited to three for convenience.
Example:  

Extension:DynamicPageList (DPL), version 2.01 : Warning: No results.