DPL:Manual - DPL parameters: Controlling output volume
Per default DPL2 will show the name of each article, including its namespace. The name will serve as a link to the article.
You can
- show the number of articles found
- suppress the namespace part of the articles´ names
- cut off the articles´ names at a certain length
- add edit data (size, author, last edited by, date of last change, ..)
- add access date (frequency, date of last access)
- add the articles´ contents or parts of it
Furthermore you can add a heading if there are some articles to display.
And you can define an alternate text which will be shown if there are no articles to display.
Contents
- 1 resultsheader
- 2 resultsfooter
- 3 oneresultheader
- 4 oneresultfooter
- 5 noresultsheader
- 6 noresultsfooter
- 7 shownamespace
- 8 addcategories
- 9 addpagecounter
- 10 addpagesize
- 11 adduser
- 12 addauthor
- 13 addlasteditor
- 14 addpagetoucheddate
- 15 addeditdate
- 16 addfirstcategorydate
- 17 include
- 18 includepage
- 19 includemaxlength
- 20 escapelinks
resultsheader
resultsheader | output a headline if there is at least one article to display. |
Syntax: resultsheader=some wiki text
Note: The symbol %PAGES% will be replaced by the number of pages found. The symbol '\n' will be converted to a newline symbol. This is useful if you want to use wiki markup which needs to start at the begin of a line. You may need to add \n if the wiki parser requires a linefeed to understand your wikitext. See Test resultsheader. If 'oneresultheader' is specified as well, the latter will be used in case there is eactly one entry in the DPL result set. Then 'resultsheader' will only be used if there are TWO or more entries in the result set.
Example:
<DPL> category=Africa mode=userformat resultsheader=There are %PAGES% pages on Africa. </DPL>
With "mode=userformat" we get complete control over the output. We do not specify "listseparators=" - so nothing will be displayed except the results header. The only thing we will get is a message about the existing number of articles.
resultsfooter | output a summary 'footline' if there is at least one article to display. |
Syntax: resultsfooter=some wiki text
Note: The symbol %PAGES% will be replaced by the number of pages found. The symbol '\n' will be converted to a newline symbol. This is useful if you want to use wiki markup which needs to start at the begin of a line.
Example:
<DPL> category=Africa mode=userformat resultsfooter=\n===There are %PAGES% pages on Africa.===\n </DPL>
With "mode=userformat" we get complete control over the output. We do not specify "listseparators=" - so nothing will be displayed except the results footer. The only thing we will get is a message about the existing number of articles. We used '\n' to make sure that our headline syntax will really be recognized by the wikitext parser. See also Test resultsheader.
oneresultheader
oneresultheader | output a headline if there is exactly one article to display. |
Syntax: oneresultheader=some wiki text
Note: The symbol '\n' will be converted to a newline symbol. This is useful if you want to use wiki markup which needs to start at the begin of a line. You may need to add \n if the wiki parser requires a linefeed to understand your wikitext. See Test resultsheader.
oneresultfooter | output a footline if there is exactly one article to display. |
Syntax: oneresultfooter=some wiki text
Note: The symbol '\n' will be converted to a newline symbol. This is useful if you want to use wiki markup which needs to start at the begin of a line.
noresultsheader
noresultsheader | output a headline if there is no article to display (empty result). |
Syntax: noresultsheader=some wiki text
Note:
Setting noresultsheader to the empty string ("noresultsheader=") will suppress the warning message from DPL" which is normally issued if no articles were found.
noresultsfooter | output a footline if there is no article to display (empty result). |
Syntax: noresultsfooter=some wiki text
Note:
noresultsfooter is essentially the same as noresultsheader. If there is no output to display the difference between header and footer becomes incredibly marginal ..
shownamespace
shownamespace | To restrict the appearance of the namespace name of a page before the page. As the switch is true by default it should be set to false if you want to avoid namespaces to be shown in the output. |
Syntax:
shownamespace=false
Example:
<DPL> category = Africa namespace = Talk shownamespace = false </DPL>
This list will output all Talk pages in [[Category:Africa]], listed without the Talk: prepended to page names.
Note that in "mode=userformat" there is a different way to decide whether you want to output the title with or without namespace. In mode=userformat two built-in variables are provided which contain the page name including the namespace (%PAGE%) and the base title name (%TITLE%).
addcategories
addcategories | Shows all categories to which an article belongs as a small text line after the article name. |
Example:
<DPL> category = Africa addcategories = true </DPL>
This will show all Africa pages together with a list of catgeories per article. Of course "Africa" will be present in each entry of the list.
Note: in 'mode=userformat' the category list can also be referenced as a built-in variable.
addpagecounter
addpagecounter | Shows number of times the page has been viewed according to the definition of the 'page_counter' field on Page_table. |
Example:
<DPL> category = Africa ordermethod = counter order = descending addpagecounter = true counter = 5 </DPL>
This will show the 5 most popular articles about Africa.
Note: in 'mode=userformat' the access counter can also be referenced as a built-in variable.
addpagesize
addpagesize | Shows the size of the page. |
Example:
<DPL> category = Africa ordermethod = size order = descending addpagesize = true counter = 5 </DPL>
This will show the 5 biggest articles about Africa.
Note: in 'mode=userformat' the size can also be referenced as a built-in variable.
adduser
adduser | Requires ordermethod=[...,]firstedit or ordermethod=[...,]lastedit (where the [...,] signifies a complex ordermethod with extra parameters). If firstedit (lastedit), 'adduser=true' displays the user who made the first (last) revision of the page. In this way the parameter is equivelent to the addauthor (addlasteditor) parameter (see below). |
Syntax:
adduser=true
If omitted, the default is false.
Example:
<DPL> category = Africa ordermethod = lastedit adduser = true </DPL>
This will output a list of pages belonging to [[Category:Africa]], prepending each result with the author of the last revision.
Note: if 'mode=userformat' the user can be referenced as the built-in variable %USER%.
addauthor
addauthor | show the user who created the article |
Syntax:
addauthor=true
If omitted, the default is false.
Example:
<DPL> category = Africa addauthor = true </DPL>
This will output a list of pages belonging to [[Category:Africa]], which shows the user who edited the initial revision of that page.
Note: addauthor and addlasteditor cannot be used within the same DPL query
addlasteditor
addlasteditor | show the user who edited the most recent revision of a page |
Syntax:
addlasteditor=true
If omitted, the default is false.
Note: addauthor and addlasteditor cannot be used within the same DPL query
addpagetoucheddate
addpagetoucheddate | Shows date/time of last change to the page according to the definition of the 'page_touched' field on Page_table.
Requires ordermethod=[...,]pagetouched or ordermethod=[...,]title. ([...,] means complex ordermethods with extra param before are allowed.) |
Example:
addpagetoucheddate=true
If omitted, the default is false.
Example:
<DPL> category=Africa ordermethod=pagetouched addpagetoucheddate=true </DPL>
This list will output a list of pages belonging to [[Category:Africa]], prepending each result with the date of last change (formatted according to your local mediawiki date display preferences or the user's preferences if logged in).
Note: in 'mode=userformat' this date can also be referenced as a built-in variable. The formatting of the date can be influenced using userdateformat=
addeditdate
addeditdate | Requires ordermethod=[...,]firstedit or ordermethod=[...,]lastedit. ([...,] means complex ordermethods with extra param before firstedit |
Purpose:
If firstedit (resp. lastedit), 'addeditdate=true' shows the date of the first revision/creation (resp. last revision) of the page.
Example:
addeditdate=true
If omitted, the default is false.
Example:
<DPL> category=Africa ordermethod=lastedit addeditdate=true </DPL>
This list will output a list of pages belonging to [[Category:Africa]], prepending each result with the date of last revision (formatted according to your local mediawiki date display preferences or the user's preferences if logged in).
Note: in 'mode=userformat' this date can also be referenced as a built-in variable. The formatting of the date can be influenced using userdateformat=
addfirstcategorydate
addfirstcategorydate | Shows the date/time the article got added to one of the listed include categories. If there are more than one categories listed and an article belongs to more than one of them, the result is ambiguous.
From a logical point of view it is recommended to include one category only with 'category' parameter or to make sure that each of the article in the result belongs to only one of the categories listed. Conflicts with other "add*date" (addeditdate, etc.) parameters to avoid confusion. |
Example:
addfirstcategorydate=true
If omitted, the default is false.
Example:
<DPL> category = Africa addfirstcategorydate = true </DPL>
This list will output a list of pages belonging to [[Category:Africa]], prepending each result with the time and date (formatted according to your local mediawiki date display preferences or the user preferences if user logged in).
Note: in 'mode=userformat' this date can also be referenced as a built-in variable. The formatting of the date can be influenced using userdateformat=
include
include | this can be used as a short name for "includepage". |
includepage
includepage | include pages (whole content) or include certain sections of articles.
This functionality is based on the ideas and work of Steve Sanbeg and his extension Labeled Section Transclusion. DPL comes with a modified version of Sanbeg´s source, so there is no need for additional installation. |
Syntax:
- To include the whole page, use a wildcard:
includepage=*
- you can use
includemaxlength=[n]
to restrict the included text to a portion of the article.
- To include sections which are labeled 'sec1' or 'sec2'... from the page (refer to Labeled Section Transclusion to know how to label sections in your pages accordingly):
includepage=sec1,sec2,...
- To include sections (chapters) by a reference to their headings: use the heading name with a "#" as prefix. This will include text from the first occurrence of the heading 'heading1' (resp. 'heading2') until the next heading of the same or lower level. (Refer to Transcluding visual headings.). Specifying a single "#" will include the text up to the first heading.
Note that the text comparison is case insensitive. Add a limit and an optional link text in square brackets to delimit the size of the included text portion to a certain number of characters. If text is cut off a link will appear which points directly to the chapter which was included. Using "0" as limit will only show the link (if the corresponding chapter in the article is not empty). When truncating included text portions care is taken not to spoil wiki syntax (i.e. maintain a symmetry of brackets and braces). Therefore the size of the included text can deviate from what you specified.
includepage = #heading1,#heading2[limit linktext],....
linktext can be
- plain text
- then this text will be used as a link
- text starting with "img="
- then the link will appear as an image link (you must provide the image in a suitable size; no scaling will happen); note that image linking only works if there is another mediawiki extension installed (LinkedImages).
- a text containing %SECTION%";
- this symbol will be replaced by "article#heading". It is up to you to create a link from this text using normal wiki syntax if you wish.
- plain text
- To include sections (chapters) by a reference to their position in the text: use a simple number with a "%" as prefix. "%0" will include the text BEFORE the first chapter, "%1" will include the first chapter, %6 the sixth and so on. Chapers are counted regardless of their level. No nesting logic is applied. "%-1" is a special value which refers to the last chapter of an article (%-2 will not work, however). "%2[30]" will include the first 30 characters of the second chapter. %SECTION% will contain the heading of the selected chapter. See Test include sections by number.
- If the selected pages contain a template call, the values of the template parameters in each page (or any result depending on them) can be included in the output: specify the original template name within single curly braces and add a suffix; the template name including the suffix will be called instead of the original template, with the same parameters, and the result will contain just the output of your alternate template (see example). Note that we pass two additional parameters to each template, called %PAGE% and %TITLE%; they allow the template to produce a link to the source file from where it was included. If a page listed in your result does not use the specified template you will get the possibility to react properly as the DPL engine will call a template with the additional suffix ".default".
- Example: includepage={myTemplate}.dpl
- If a page does not contain a reference to "Template:myTemplate" then "Template:myTemplate.dpl.default" will be invoked with %PAGE% and %TITLE% as parameters.
includepage = {template1}suffix1,{template1}suffix2,{template2}suffix3,....
- There is a short notation if you only want to include one single template parameter: You can write something like
include={template}:2,{template}:History
- This will include the second unnamed parameter and the named parameter "History".
- You can combine all of the above variants:
includepage = sec1,#heading1,{template1}ext1,....
- To include nothing from the page (no inclusion), leave blank (this is default):
includepage=
Example: includepage = foo,#bar[200 ..more..],#bang[0 img=my.gif],{boo}.dpl
This will include
- a text portion which is marked by special tags named "foo"
- the contents of a chapter named "bar"; only the first 200 characters of wiki text will be shown; if the chapter is larger than that, a link with the text "..more.." will point to the source
- an image link based on "my.gif" to the chapter "bang" in the article - if there is such a chapter and it is not empty
- the output of template "boo.dpl" being called with the same parameters that were used to call template "boo" in the original page.
Note: See also DPL:Manual - DPL parameters: Criteria for page selection#includematch.
includemaxlength
includemaxlength | Delimit the size of an included article to a maximum of [n] characters of wiki source text or less.
Care is taken to respect pairs of braces and brackets as far as possible. Otherwise we might confuse the result by half-cut syntax elements of transcluded sections. Therefore the output might be shorter or even larger than [n] characters. |
Syntax:
includemaxlength=[n]
Note: this parameter is only used in combination with includepage=*
; truncation of included chapter contents is specified by adding a limit in sqauare brackets within the 'includepage=' statement.
escapelinks
escapelinks | Regarding images and categories this parameter allows you to decide whether
|
Syntax:
escapelinks=false
Note: You can use this parameter to show images; an other way to do this is to use the gallery extension in combination with DPL; there is an example for this on the dpldemo website.