Help:DPL using templates

From Ballotpedia
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:  
Jeffrey R. Howard
Jeffrey R. Howard
Placeholder image.png
Do you have a photo that could go here? Submit it for this profile by emailing us!
Court Information:
United States Court of Appeals for the First Circuit
Title:   Judge
Position:   Seat #2
Station:   Concord, NH
Service:
Appointed by:   George W. Bush
Active:   5/3/2002-Present
Preceded by:   Norman Stahl
Personal History
Born:   November 5, 1955
Hometown:   Claremont, NH
Undergraduate:   Plymouth State University, 1978
Law School:   Georgetown University Law, 1981


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:  
Jeffrey R. Howard

Born in Claremont, New Hampshire, Howard graduated from Plymouth State College with his bachelor's degree in 1978 and later graduated from Georgetown University Law Center with his Juris Doctor degree in 1981.[1]


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:  
Jeffrey R. HowardHowardGeorgetown University Law, 1981


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:  
Jeffrey R. HowardHoward


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:  
This is a list of former federal judges:

Judge Jeffrey R. HowardUnited States Court of Appeals for the First Circuit Born in Claremont, New Hampshire, Howard graduated from Plymouth State College with his bachelor's degree in 1978 and later graduated from Georgetown University Law Center with his Juris Doctor degree in 1981.[1]

Howard served as Staff Attorney for the New Hampshire Attorney General's Office from 1981 to 1988. From 1988 to 1989, Howard was Deputy Attorney General of New Hampshire Attorney General's Office. Howard was nominated by President George H.W. Bush as U.S. Attorney for the District of New Hampshire and served there from 1989 to 1993. After successful election, Howard served as New Hampshire Attorney General for New Hampshire from 1993 to 1997. Howard entered private practice in New Hampshire from 1997 to 2002.[1]

The page has loading... hits and was created by Madison.

Judge Juan TorruellaUnited States Court of Appeals for the First Circuit Torruella was born in 1933 in San Juan, Puerto Rico. He graduated from the Wharton School at the University of Pennsylvania with his bachelor's degree in 1954 and graduated from Boston University School of Law with his J.D. degree in 1957. He went on to graduate from the University of Virginia School of Law with his Master of Laws degree in 1984 and earned a Master's in Public Affairs from the University of Puerto Rico School of Public Administration in 1984.[1]

Torruella was a private practice attorney licensed in Puerto Rico from 1959 to 1974.[1]

  1. Cite error: Invalid <ref> tag; no text was provided for refs named bio
The page has loading... hits and was created by Madison.

Judge Sandra Lea LynchUnited States Court of Appeals for the First Circuit Lynch received her undergraduate degree from Wellesley College in 1968 and her J.D. from the Boston University School of Law in 1971.[1]

  • 1978-1995: Attorney, private practice
  • 1990-1992: Special Counsel, Judicial Conduct Commission of Massachusetts
  • 1974-1978: General Counsel, Massachusetts Department of Education
  • 1973-1974: Assistant Attorney General, Massachusetts Attorney General's Office
  • 1971-1973: Law clerk, Judge Raymond Pettine of the District of Rhode Island[1]
  1. Cite error: Invalid <ref> tag; no text was provided for refs named FJC_Bio
The page has loading... hits and was created by Madison.
List completed!