Help:DPL basics

From Ballotpedia
Jump to: navigation, search
Ballotpedia:WikiProject Help

Dynamic Page Lists (DPLs) are wiki tools used to generate lists of material and information based on metadata attached to the pages. Simple DPLs allow you to collect a group of links to pages automatically onto one page that share a common category, template, user or other feature. The easiest way to employ DPLs is through categories. If you want to use DPLs on your project, you will need a strong category structure.

Advanced DPLs allow you to modify a list with formatting and metadata (timestamps, page counts, page hits). Information displayed in a DPL can be formatted in a list, table or chart. For more information about editing advanced DPLs, see Help:DPL advanced editing.

[edit]

When to use DPLs

Pros

  • DPLs save time by limiting the number of pages that need to be updated when information changes.
  • DPLs can automatically collect information from a group of pages and present it in an easy to read format.

Cons

  • DPLs can be taxing on the server and should only be used when pages are truly dynamic, i.e. the pages change with relative frequency based on other information being posted to the wiki. Historical pages can use DPLs to generate original tables but should be converted to wikitables.
  • DPLs require advanced knowledge of wiki code to edit.
  • Updating the information in a DPL is not intuitive for non-employee users.
  • DPLs require concrete and established category structures to employ.
  • The complex nature of DPL code requires attention to detail to prevent mistakes.

Two types of DPLs

Below the differences of parser code DPLs and HTML/tag DPLs are explained. The formatting differences are highlighted in the chart.

Parser code

  • Parser function DPLs can be used on any page.
  • Each criteria begins on a new line with a pipe (|) symbol
  • Pipe symbols within the code itself (not starting a line) must use the pipe template {{!}}.

Tags

  • Tags cannot be used within templates.
  • Each criteria needs its own line.

Comparison

Parser:Tags

{{#dpl:
|category = Red{{!}}Blue
|category = Some
}}

<dpl>
category = Red|Blue
category = Some
</dpl>

Examples of DPLs on Judgepedia

DPLs are widely used across Judgepedia. Below are examples of pages with DPLs of varying complexity.

  • A more complex DPL is on Intermediate appellate courts. That table is created using information found in the infobox on individual intermediate appellate court pages.

Basic DPLs are composed of the opening tag and then a number of prompts, similar to a transcluded infobox. These prompts tell the DPL which pages to collect, what information to collect from the pages and how to present it on a page. The most basic DPL merely provides a criteria for page selection. The following commands are commonly used to select certain pages to include in the DPL:

PromptCriteria included
"|category = "Summons all pages in a category.
"|notcategory = " Excludes a particular category from the list.
"|categorymatch = "Includes categories using a keyword search. For example “|categorymatch = %Kansas%” would include pages from all categories that have “Kansas” in the category name. "%" is used like a wild card and denotes additional characters on that side of the text.
"|namespace = " Summons all pages that are within a namespace including “Talk, Category, Judgepedia, WikiProject, etc.” Namespaces with multiple words use an underscore (_) between words.
"|notnamespace = " Excludes a particular namespace from the list. Often used for excluding Category and Talk pages when only regular (Main) pages are desired.
"|title = " Includes a specific page based on its exact title.
"|titlematch = " Similar to categorymatch but with titles.
"|nottitlematch = " Excludes pages based on the presence of a specific portion of text in their title.
[1]

Examples

Example:  Category
Code:  
{{#dpl:
|category = Federal judge, District of Kansas
}}
Description:  
Will produce a bulleted list of all of the pages within the category, “Federal judge, District of Kansas”.
Example:  


Example:  Title
Code:  
{{#dpl:
|title = Supreme Court of the United States
}}
Description:  
Will produce a single item list including the page with the title “United States Supreme Court”
Example:  
Supreme Court of the United States


Example:  Matching
Code:  
{{#dpl:
|titlematch = %Kansas%
|count = 10
}}
Description:  
Will produce a list of 10 pages that have the word “Kansas” in the title.
Example:  


Complex selection criteria

  • You can create "and" "or" statements using combinations of criteria and categories.
  • Two categories separated by a pipe will summon all of the pages that contain either Category1 or Category2.
  • |category = Category1{{!}}Category2
  • Two categories listed separately will list all of the pages that contain both categories.
  • |category = Category1
    |category = Category2
  • You can restrict results to only categories or to only pages by adding controls for namespace.
  • You can add a specific page to a list by adding “|title = “ or remove a specific page using “|nottitlematch =“.
  • Whenever you add more than one criteria to a DPL it automatically creates an "and" function which requires both of those criteria to be met.[2]

Examples

Example:  And statement with restriction
Code:  
{{#dpl:
|category = Current federal judge
|category = Harvard Law Alumni
|notcategory = Appointed by Barack Obama
|count = 10
}}
Description:  
Will produce a bulleted list of all the pages that contain both the category “Current federal judge” and “Harvard Law Alumni” but will exclude all of the above pages with the category “Appointed by Barack Obama”. The count is restricted to ten pages for simplicity.
Example:  

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


Example:  Or Statement
Code:  
{{#dpl:
|category = Federal judge, District of Kansas{{!}}Federal judge, District of Nebraska
|count = 10
}}
Description:  
Will produce a bulleted list of all of the pages within the category, “Federal judge, District of Kansas” as well as all of the pages within the category “Federal judge, District of Nebraska”. These pages will be mixed together and not separated out. The count is restricted to ten for simplicity.
Example:  


Example:  Category and Limiting Namespace
Code:  
{{#dpl:
|category = Former federal judge
|notnamespace = Category
|count = 10
}}
Description:  
Will produce a bulleted list of all of the pages within the category, “Former federal judge” but will specifically exclude the categories that are listed within that category. Note that this is not default and any category with both pages and categories listed under it will display both regular pages and categories in a DPL. Count is limited to ten for simplicity.
Example:  


Example:  Matching title with limited namespaces
Code:  
{{#dpl:
|titlematch = %Kansas%
|notnamespace = Talk
|notnamespace = Template_talk
|notnamespace = Category_talk
|count = 10
}}
Description:  
Will produce a bulleted list of all pages with “Kansas” in the title but will exclude all “Talk:”, “Template talk:” and “Category talk:” pages. Count is limited to ten for simplicity.
Example:  


Ordering your results

  • You can change the order of the entries in a DPL by adding the criteria: “|ordermethod = “. Possible orderings include:
CodeSort Category
|ordermethod = sizeSorts by pages size. (Need “|addpagesize = true” in the code)
|ordermethod = firstedit/lasteditSorts by the page creation or the last time the page was edited. (Need “|addeditdate = true” in the code)
|ordermethod = titleSorts by title, default sort.
|ordermethod = categoryaddSorts by the date that the page was added to the first category listed.
More Here
  • You can change the order from ascending to descending using “|order= “ and either “ascending” or “descending”
  • On Judgepedia, all DPLs require the code, “|ordermethod = firstedit/lastedit”[3]

Formatting your results

  • DPLs naturally format as a bulleted list of entries and include only the name of the page.
  • You can use the “|format = “ criteria to override this and edit the information how you would like it to appear.
  • The code for the format line contains four important elements and each element is separated by a comma:
  • “|format = TEXT1,TEXT2,TEXT3,TEXT4”
  • TEXT1: Information and code that should appear in front of the entire DPL appears before the first comma in the code.
  • TEXT2: Information and code that should appear at the front of every individual page entry goes after the first comma but before the second.
  • TEXT3: Information and code that should appear at the end of every individual page entry goes after the second comma but before the third.
  • TEXT4: Information that goes at the end of the DPL goes after the third comma
  • Any wiki or HTML code can be added in these sections to edit the font, build a table with the information (HTML only) or change it from bulleted to numbered lists.
  • \n* = indicates that every entry will start on a new line with a bullet
  • \n# = indicates that every entry will start on a new line with a number
  • All punctuation MUST use html numbers. Those can be found here in column 3.[4]
  • IMPORTANT NOTE: including a format line requires you to tell the DPL where in the format you want the page title to appear. This can be done by using the code [[%PAGE%{{!}}%TITLE%]] for a linked title or %TITLE% for a non-linked title.
Example:  Formatted numbered list
Code:  
{{#dpl:
|category = Former federal judge
|notnamespace = Category
|ordermethod = firstedit
|format = <center>This is a list of former federal judges:<center><hr>,\n#Judge  [[%PAGE%{{!}}%TITLE%]],is awesome., ,<br/>List completed!
|count = 10
}}
Description:  
Complex formatting with a numbered list.
Example:  
This is a list of former federal judges:

  1. Judge John Marshall (Supreme Court)
  2. Judge Stephen Breyer
  3. Judge John Minor Wisdom
  4. Judge Moses Hallett
  5. Judge William E. Doyle (Colorado)
  6. Judge Lorenzo Sawyer
  7. Judge Joseph McKenna (Supreme Court)
  8. Judge William Ball Gilbert
  9. Judge Erskine Mayo Ross
  10. Judge William Henry Hunt
    List completed!


Counting pages with DPL

A specific format will allow you to count pages with a DPL, rather than creating a list of those pages. To do this, simply add one comma to the "format" line and add another line for "resultsheader = %PAGES%".

Example:  Page count
Code:  
{{#dpl:
|categorymatch = Alaska superior court judges, % District
|notnamespace=Category
|notnamespace=Talk
|format = ,
|resultsheader = Number of Alaska superior court judges: %PAGES%
}}
Description:  
Outputs the number of pages that have the category "Alaska superior court judges, ___ District," along with a description.
Example:  
Number of Alaska superior court judges: 42


Simple table formatting

You can easily create a table of the content included in your DPL by adding the "table" line to the DPL code.

Simply add the column titles for each included piece of information: |table=Column 1 title,Column 2 title,Column 3 title.

Whatever is in your "include" line (template parameters, sections of a page, etc.) will populate the cells in those columns. The first column will be the page names. The following columns will be filled in order of your "include" functions.

Code:

{{#dpl:
|category = Florida circuit court judges, Third Circuit
|notnamespace = Category
|notnamespace = Talk
|include = {Judge infobox}:Law
|table=class="wikitable sortable",Judge,Law school
}}

Description: Outputs a sortable table of the judges categorized under "Florida circuit court judges, Third Circuit," with their name in the first column and their law school in the second column (see above for example).

Example:

Judge Law school
Andrew J. Decker, III
David W. Fina Cumberland School of Law, 1984
Greg S. Parker Florida State University, 1984
Leandra G. Johnson University of Florida, 1981
Mark Feagle
Paul S. Bryan University of Florida, 1977
Wes Douglas Florida Coastal School of Law


Cite error: <ref> tags exist, but no <references/> tag was found