Help:DPL/manual/format

From Guild Wars 2 Wiki
Jump to navigationJump to search

This page documents how to modify the output format of any DPL query. This includes lists, tables, custom formats, including chunks of data from other pages, and adding metadata.

General approach to output formatting[edit]

The general approach to output formatting is two-fold:

  1. There are a couple of simple predefined output formats which generate lists of articles - You will understand their meaning directly from reading.
  2. There is a mode called userformat which puts complete control into your hands - This is somewhat complicated...

While the standard output formats are meant to be used for fast generation of simple page lists, the userformat approach aims at transcluding contents from other pages and requires some effort to understand. There is a system of three tags which are used to enclose (a) the whole output, (b) each item, (c) each transcluded section of an item. A fourth tag is used to separate values between items of one section which occur more than once.

We assume that we have two documents which use templates x and y with varying arguments; while x is being used once within each document, y is used several times. In very short notation the structure might look as follows:

 A: x(a) y(3) y(5)
 B: x(b) y(4) y(1) y(2)

The following DPL parameters are used to define a set of tags which are used to construct the output:

The arguments of the above statements can contain references to %VARIABLES%. So sec-1-start might contain a reference like %PAGE% to output the page name. See format for more details on variable substitution.

Now think of the following page inclusion statement:

  includepage={x}.dpl,{y}.dpl

The output will then look like this:

  liststart
     itemstart
        sec-1-start
           x.dpl(a)
        sec-1-end
        sec-2-start
           y.dpl(3)
           multi-sep
           y.dpl(5)
        sec-2-end
     itemend
     itemstart
        sec-1-start
           x.dpl(b)
        sec-1-end
        sec-2-start
           y.dpl(4)
           multi-sep
           y.dpl(1)
           multi-sep
           y.dpl(2)
        sec-2-end
     itemend
  listend

Assuming that the tags (liststart, itemstart, etc.) contain wiki syntax for table definitions and multi-sep defines a horizontal line, the output might look like this:

  +------+---------------------+
  |      |          | y.dpl(3) |
  |  A   | x.dpl(a) |  ----    |
  |      |          | y.dpl(5) |
  +------+----------+----------+
  |      |          | y.dpl(4) |
  |      |          |  ----    |
  |  B   | x.dpl(b) | y.dpl(1) |
  |      |          |  ----    |
  |      |          | y.dpl(2) |
  +------+----------+----------+

In some situations, however, you may want to create an output table where each of the calls of template y is used to create a separate output row. Using a sortable table you could then easily rearrange the output.

  +------+---------------------+       +------+---------------------+
  |  A   | x.dpl(a) | y.dpl(1) |       |  B   | x.dpl(b) | y.dpl(1) |
  +------+---------------------+       +------+---------------------+
  |  A   | x.dpl(a) | y.dpl(2) |       |  B   | x.dpl(b) | y.dpl(2) |
  +------+---------------------+       +------+---------------------+
  |  B   | x.dpl(b) | y.dpl(3) |       |  A   | x.dpl(a) | y.dpl(3) |
  +------+---------------------+       +------+---------------------+
  |  B   | x.dpl(b) | y.dpl(4) |       |  A   | x.dpl(a) | y.dpl(4) |
  +------+---------------------+       +------+---------------------+
  |  B   | x.dpl(b) | y.dpl(5  |       |  B   | x.dpl(b) | y.dpl(5) |
  +------+---------------------+       +------+---------------------+

There is a special parameter called dominantsection which you can use to mark one section of your includepage statement as "dominant" (in our example: dominantsection=2 as {y}.dpl is the second argument of our includepage statement). You can only have one dominant section in a DPL statement. Marking a section as "dominant" only makes sense if you have multiple calls of the same template (or multiple chapters with the same heading) in your documents. Each piece of content in the dominant section will generate an individual output row with the values of all other columns being repeated.


As all of the above is not very easy to understand, there are additional DPL commands (table, tablerow) which make it fairly easy to create tabular output.

Setting the basic output mode[edit]

mode[edit]

mode

Provide basic control over the output of DPL.

Syntax:

mode=modename

modename can be one of:

unordered
outputs an unordered list — HTML tag ul(default)
ordered
outputs an ordered list — HTML tag ol
none
outputs a list using newlines and HTML tags br/ to separate each item
inline
outputs a list using symbols defined by the inlinetext parameter to separate items
category
outputs resulting articles in a way category-pages are shown (you must use ordermethod= title / titlewithoutnamespace / category,title / user,title with this option!)
userformat
will leave output control completely to the user;
see parameters listseparators' and secseparators; in this mode DPL offers built-in variables which must be referenced in the output format description provided by the user. 'mode=userformat is quite important to have complete control over the output.

For advanced use of DPL it is important to understand mode. Note that this mode is automatically implied when listseparators= or format= are used.

mode 'ordered', 'unordered', 'none' (Example1)[edit]

These create abbreviated lists of "Category:DPL3" pages:

In an ol list: In a ul list: In a br list:
<dpl>
  category=DPL3
  titlematch=%o%
  nottitlematch=%nt%|%ow%|%ec%
  mode=ordered
</dpl>
<dpl>
  category=DPL3
  titlematch=%o%
  nottitlematch=%nt%|%ow%|%ec%
  mode=unordered
</dpl>
<dpl>
  category=DPL3
  titlematch=%o%
  nottitlematch=%nt%|%ow%|%ec%
  mode=none
</dpl>

mode 'category' (Example2)[edit]

This list will output pages that have 'Help' in their name; pages will be ordered by their name regardless of category, the output will be shown in category style (i.e. with chapter capitals).

<dpl>
  titlematch=%Help%
  includesubpages=false
  mode=category
  ordermethod=titlewithoutnamespace
</dpl>

mode 'inline'[edit]

inlinetext[edit]
inlinetext

To define the inline text used in mode=inline.

Syntax:

inlinetext=wikitext, with wikitext as some wiki text; default is nbsp;-nbsp; except for mode=userformat where inlinetext is empty by default.

If you want normal "breaking spaces" (and not the NON-breaking spaces) you should use &#32-&#32.

Extra whitespaces are stripped by DPL from the beginning and end of wikitext. If you want to show one or multiple spaces, use one or multiple & nbsp;, or use 'nowiki' tags <nowiki> - </nowiki> which has the same effect as nbsp;-nbsp; (with ampersands).

Bullets can be displayed with either &bull or {{bullet}}.

Example:

<dpl>
  category	= Help
  includesubpages= false
  count		= 10
  mode		= inline
  inlinetext	= &nbsp; &bull; &nbsp;
</dpl>

This list outputs pages that have Category:Help shown like Item1 • Item2 • Item3 • ...

mode 'userformat'[edit]

listseparators[edit]
listseparators

(alias for format) see the format parameter. Implicitly sets mode=userformat.

format[edit]
format

customize the output format completely. Implicitly sets mode=userformat. Uses variable references like %PAGE% to describe the output format. See also the secseparators parameter.

Note1: listseparators is an alias for format.

Note2: the format command is very flexible but somewhat complicated. If you want to create tabular output, you should have a look at the table command.

Syntax:

format=Startall,Start,End,Endall

Startall, Start, End and Endall are wiki tags used to separate the list items.

  • Startall and Endall define an outer frame for the whole list.
  • Start and End build an inner frame for each article item.

Because wiki syntax depends on newline characters, \n or must be used to explicitly insert newline characters into the output.

As we want to be able to control output completely, we reference article names and other possible output by special %VARIABLES%:

  • %NR% = the current article sequence number (starting from 1)
  • %PAGE% = the name of the article (including namespace)
  • %PAGEID% = the internal unique numeric ID of the article page
  • %IMAGE% = the physical path to an image (based on hash values, e.g. 5/5d/myImage.jpg)
  • %PAGESEL% = the name of a page which was used within the selection criteria (only applies to linksfrom and linksto)
  • %IMAGESEL% = the name of an image which was used within the selection criteria (only applies to imageused)

  • %TITLE% = the title of the page (without the namespace)
  • %NAMESPACE% = the namespace of the page

  • %SIZE% = the article size (requires addpagesize=true)
  • %SIZEFS% = a font size number which is based on the article size (logarithm of square root of counter)

  • %DATE% = the date selected, eg. lastedit; requires addeditdate=true or similar; the formatting of the date can be influenced using userdateformat=
  • %USER% = the user who changed the document last; requires adduser=true

  • %CONTRIBUTOR% = the user who made a contribution; requires addcontribution=true
  • %CONTRIBUTION% = the number of bytes changed; requires addcontribution=true
  • %CONTRIB% = an asterisk bar to indicate the amount of change; requires addcontribution=true

  • %CATLIST% = a pipe-separated list of links to all categories to which the article belongs (requires addcategories=true)
  • %CATBULLETS% = a bullet point list of links to all categories to which the article belongs (requires addcategories=true)
  • %CATNAMES% = a comma-separated list of all categories to which the article belongs (requires addcategories=true)

  • %REVISION% = the name of the revision of the article; only accessible if the DPL query is based on revisions
  • %EDITSUMMARY% = the change log message of a revision; only accessible if the DPL query is based on revisions

  • %EXTERNALLINK% = the external hyperlink found as a consequence of the linkstoexternal statement

These variables will be replaced by the corresponding values if they occur within Start or End or within the corresponding tags of the secseparators= parameter.


In addition there are some symbolic variables which can ONLY be used in resultsheader and resultsfooter:

  • %PAGES% = number of articles in the result set
  • %TOTALPAGES% = total number of articles in the result set, regardless of count limits; will only be calculated if used
  • %VERSION% = the current DPL version

  • %DPLTIME% = contains the amount of time (in seconds + milliseconds) spent within DPL; this can be helpful if you observe slow response times for wiki pages that contain DPL statements. Example: 2 (2009/06/13 09:27:43) would mean that DPL spent two seconds of the whole response time, starting at the time given in brackets.

  • %FIRSTNAMESPACE%, %FIRSTTITLE%, %LASTNAMESPACE%, %LASTTITLE% = namespace and title of the first / last article in the result set; the information is intended to be used for page scrolling
  • %SCROLLDIR% = set by the URL parameter DPL_scrollDir; it is passed to the scroll helper template which uses it to produce its links for scrolling

For example, the classical default output of DPL can also be produced with the following statements:

default formatted
<dpl>
  titlematch	  = %Help%
  nottitlematch	  = %o%
  includesubpages = false
</dpl>
<dpl>
  titlematch	  = %Help%
  nottitlematch	  = %o%
  includesubpages = false
  format	  = ,\n* [[%PAGE%]],,
</dpl>

Note that a bullet point list in wiki syntax is defined by a * at the beginning of a line — therefore we have to use a special symbol \n or to refer to the beginning of a new line of wiki text. Replace the * with a # and you will get a numbered list. Startall and Endall are empty (note that we start with a comma, note the two commas at the end), the Start tag is used to create a new line with an initial * followed by the page name, written as a link. That's all.

Creating a top-five hitlist with access rates and bold article names of varying size could be done like this:

<dpl>
  category	 = Help
  ordermethod	 = counter
  order		 = descending
  addpagecounter = true
  count		 = 5
  format	 = ,\n%COUNT%  --- <font size="%COUNTFS%">'''[[%PAGE%]]'''</font>,<br/>,
</dpl>

However, addpagecounter, ordermethod=counter, %COUNT%, and %COUNTFS% were removed in MediaWiki 1.25.
Below is an example of how to use %NR% to set the font size.

<dpl>
  category	 = Help
  order		 = descending
  addpagecounter = true
  count		 = 4
  format	 = ,\n<font size="%NR%">'''[[%PAGE%]]'''</font>,<br/>,
</dpl>

Guild Wars 2 Wiki:FAQ
Help:Contents
Help:Searching
Help:Templates

You can also use HTML syntax for the tags, although this is discouraged.

<dpl>
  linksto = Main Page
  count = 3
  format = <ul type="disc">,<li>[[%PAGE%]],</li>,</ul>
</dpl>

Now let us create a table using wiki syntax:

<dpl>
  linksto = Main Page
  count = 3
  format = {| class="wikitable"¶!pages found,¶|-¶|[[%PAGE%]],,¶|}
</dpl>

We use Startall to define the table header and Endall for the footer. Each article is presented in a table row using wiki syntax for table layout.

pages found
MediaWiki:Abusefilter-format-warning
MediaWiki:Abusefilter-warning-possible-linkspam
April Fools' Day 2023/Spring 2023 Update

We could also produce image galleries:

<dpl>
  namespace = File
  category  = Sylvari screenshots
  count	    = 3
  format    = <gallery widths=80px heights=80px>,%PAGE%\n,,</gallery>
</dpl>
secseparators[edit]
secseparators

customize the output format of included sections. Can be used with standard output modes and with mode=userformat.

Syntax:

secseparators=Start1,End1,Start2,End2,..,..

or

secseparators=Start

In the first syntax variant, specify pairs of tags which correspond to the includepage statement. StartN and EndN are HTML strings or wiki tags which will be put around each transcluded section (see includepage=name1,name2,...).

In the second syntax variant, specify just one element which will then be used as StartN for all sections; in this case the second tag (EndN) will be empty for all transcluded sections.

Symbolic replacements of %PAGE% etc. take place as described in listseparators. In addition, the variable %SECTION% can be used to refer to the section found (works only for chapter headings).

If the same section occurs more than once in an article (or an article includes the same template more than once) all such occurences will be transcluded as a block and the secseparators tags will only be put once around the whole block (but see dominantsection).

Example
<dpl>
  titlematch     = DPL3/d%
  ignorecase     = true
  linksto        = Extension:DPL3/Manual
  listseparators = {|class="dpl secsep"¶!Pages found¶!Syntax¶!Example,¶|-¶|[[%PAGE%|%TITLE%]],,¶|}
  includepage    = #Syntax,##Example.*
  secseparators  = ¶|,,¶|,,
  count          = 2
</dpl>

Use listseparators to define a table with three columns and put a link to the article in the first column of each row. Use secseparators to add more columns for each section found. There are two pairs for each transcluded section; the first element of each pair is a linefeed and a pipe (which define a new column in the table) and the second element of each pair is empty. Have a careful look at the symbols (\n can be used as an alternative). They always appear before a wiki syntax element which must be placed at the beginning of a new line. Thus, make sure that the wiki parser will understand them. Note: if an article does not contain a section named "Example", it will result in an empty cell in the table.

As mentioned above, a single element can be used in the secseparators statement in order to apply this as a start tag to all transcluded sections; so it could have also been written:

Example 2
<dpl>
  titlematch     = DPL3/d%
  ignorecase     = true
  linksto        = Extension:DPL3/Manual
  listseparators = {|class="dpl secsep"\n!Pages found\n!Syntax\n!Example,\n|-\n|[[%PAGE%|%TITLE%]],,\n|}
  includepage    = #Syntax[84],##Example.*[180 more..]
  secseparators  = \n|
  count          = 3
</dpl>

Assuming that the chapters on Syntax and Example contain long texts, they can be truncated (eg. to 84 or 180 characters). A link which refers directly to those chapters will be generated automatically if needed. Be aware that truncating with [ ]can break text formatted with wikitext or tags such as o.

multisecseparators[edit]
multisecseparators

put a tag between multiple transcluded parts which refer to the same template or chapter.

Syntax:

multisecseparators=sep1,sep2,...

The tags correspond to the transcluded section (see includepage=name1,name2,...).

Symbolic replacements of %PAGE% etc. take place as described in listseparators. In addition, the variable %SECTION% can be used to refer to the section found (works only for chapter headings). It will give you the precise name of each heading even if you used a regular expression (double ##) in the include statement.

If an article uses the same template more than once you will get all references with sepN as a separator.

Example:

<dpl>
  titlematch	    = DPL%
  nottitlematch	    = %volume%|%page selection%
  uses		    = Template:DPL Parameter
  include	    = {dpl manual}:[[%PAGE%|%TITLE%]],{dpl parameter}:name:purpose[50]
  mode		    = userformat
  listseparators    = ¶{|class="wikitable sortable" ¶!colspan=3|Fields cannot be formatted within the include¶|-¶!Page ¶!Name ¶!Purpose,¶|-,¶|-¶|class="dpl blue-background" colspan=3|¶|-,¶|}
  secseparators	    = ¶|,,¶|class="dpl dark-background"|,
  multisecseparators= ,\n|-¶|¶|class="dpl light-background"|
</dpl>


Values cannot be formatted within include, as formatting can only occur in formatting statements (in these examples listseparators, secseparators, and multisecseparators). %VARIABLES% can be omitted from the include, and instead be placed in these formatting statements, for further formatting.

We can achieve some field formatting by changing some of the above dpl statements:

  include	= {dpl manual}:{{#tag:tt|%TITLE%|class="dpl light-background"}},{dpl parameter}:name:purpose[50]
  listseparators = ¶{|class="wikitable sortable" ¶!colspan=3|Fields... secseparators¶|-¶!Page ¶!Name ¶!Purpose,¶|-,¶|-¶|class="dpl blue-background" colspan=3|¶|-,¶|}
  secseparators  = ¶|{{#tag:tt|[[%PAGE%|{{#explode:,|:|1}}]]|class="dpl light-background"}},¶|class="dpl dark-background"|,

or

  include	= {dpl manual}:{{#tag:tt||class="dpl light-background"}},{dpl parameter}:name:purpose[50]
  listseparators = ¶{|class="wikitable sortable" ¶!colspan=3|%VARIABLES%... listseparators¶|-¶!Page ¶!Name ¶!Purpose,¶|-{{#tag:tt|¶|[[%PAGE%|{{#explode:%TITLE%|:|1}}]]|class="dpl light-background"}},¶|-¶|class="dpl blue-background" colspan=3|¶|-,¶|}
  secseparators  = {{#tag:tt||class="dpl light-background"}},,¶|class="dpl dark-background"|,{{#tag:tt|,¶|,|class="dpl light-background"}}

Formatting handled by a phantom template (eg. "Template:DPL parameter dpl") will apply to both secseparators and multisecseparators.

If separate formatting is required, it needs to be assigned to their respective parameters (as shown below).

To prevent truncated words, see "Template:DPL parameter dpl.nowordbreak" (which uses "Template:nowordbreak").

<dpl>
  titlematch	    = DPL%
  nottitlematch	    = %volume%|%page selection%
  uses		    = Template:DPL Parameter
  include	    = {dpl manual}:,{DPL parameter} dpl
  mode		    = userformat
  listseparators    = ¶{|class="wikitable sortable" ¶!colspan=3|Includes a phantom template¶|-¶!Page ¶!Name ¶!Purpose,¶|-¶|[[%PAGE%|{{#explode:%TITLE%|:|1}}]],¶|-¶|class="dpl blue-background" colspan=3|¶|-,¶|}
  secseparators	    = ,,¶|class="dpl dark-background"|,,¶|,
  multisecseparators= ,\n|-¶|¶|class="dpl light-background"|
</dpl>
<dpl>
  titlematch		= DPL%
  nottitlematch		= %volume%|%page selection%
  uses				= Template:DPL Parameter
  include={dpl manual}:,{DPL parameter} dpl.nowordbreak
  mode				= userformat
  listseparators	= ¶{|class="wikitable sortable" ¶!colspan=3|Includes a phantom template with Template:nowordbreak¶|-¶!Page ¶!Name ¶!Purpose,¶|-¶|[[%PAGE%|{{#explode:%TITLE%|:|1}}]],¶|-¶|class="dpl blue-background" colspan=3|¶|-,¶|}
  secseparators		= ,,¶|class="dpl dark-background"|,,¶|,
  multisecseparators= ,\n|-¶|¶|class="dpl light-background"|
</dpl>

As you can see, the results resemble the list generated on the title page of this manual, whose dpl is as follows:

<dpl>
  nottitlematch=%volume%|%page selection%
  namespace = Help
  uses = Template:DPL parameter
  mode = userformat
  replaceintitle = @DPL Manual/@,
  include = {DPL Manual}:[[%PAGE%|%TITLE%]],{DPL parameter}/dpl
  listseparators={|class=wikitable,\n|-\n|,,\n|}
  secseparators=,,\n|\n{|class="wikitable sortable" width=100%\n!width=140px|name\n!purpose\n|-\n|,\n|}
  multisecseparators=,\n|-\n|
  allowcachedresults = true
</dpl>
dominantsection[edit]
dominantsection

define a section with multiple occurrences as dominant, i.e. each piece of contents of this section (which is associated with a template call or a chapter within the original document) will create a separate output line.

Syntax:

dominantsection=number between 1 and the number of arguments in your includepage= statement

If there is only 0 or 1 piece of contents for the dominant section you will see no difference from normal DPL behaviour.

Example:

See the explanations at the top of this document to understand the meaning of dominantsection.

Note: Using dominantsection together with table may lead to strange result formatting.

Generating tabular output[edit]

table[edit]

table

a simple syntax to create standard tabular output; see also tablerow

Syntax:

table=tableatr, linkheader, (column headlines) ..

The table statement is a shortcut which implicitly sets certain values for other DPL parameters, namely mode, listseparators / format, secseparators, and multisecseparators.

The layout is less flexible than the individual use of all of the above parameters but will probably be sufficient in many cases, especially when used together with tablerow.

If you use table in a DPL statement, it does not make sense to use one of the other options mentioned because their values will be overwritten without notice. There is one exception of this rule: It can make sense to specify the THIRD argument for format in combination with table. Therefore this parameter is NOT overwritten by the table command. The third argument can be used to output meta data like %COUNT%, %USER% etc. as columns in an output table. If you want to do so, the third parameter must contain wiki syntax for output columns like this:

include = {some template}:parm1,#some heading
table   =,,tplparm,chapter,#hits
format  =,,\n%COUNT%

Do not forget to escape the '|' symbol if your DPL statement uses parser function syntax. You will get a table which contains template parameters, chapter contents and the usage counter as a third column. Meta data can only be placed AFTER normal contents as we use the THIRD parameter of the format statement.

The use of table requires an include statement which should, for reasons of readability, directly precede the table statement). Each argument of the include statement will produce one or more columns in the output table described in the table statement.

'table' expects a comma-separated list of parameters:

  • The first parameter will be used to describe general parameters for the table
    • it is recommended to make a CSS reference here, using something like class=wikitable or class=mytable if mytable is defined in the Mediawiki:Common.css document.
    • class=wikitable is the default value. Use double-quotes to specify multiple classes, e.g., class="wikitable sortable".
  • The second parameter is the headline for the first column.
    • The first column will automatically contain a reference to the article, so something like Article should be o.k.
    • Article is the default value.
    • if you use a single - (dash), the column with the hyperlink to the article will be suppressed. You can supply a hyperlink to the article in any other column if you use [[{{{%PAGE%}}}|{{{%TITLE%}}}]] within a phantom template.
  • All subsequent parameters are column headings which correspond to the arguments of the include parameter. Note that if you call a phantom template (like {Some Template}.dpl) in the include statement, you will have to provide as many headlines as the phantom template produces columns.
  • mode will be set to userformat
  • listseparators will be configured to produce wiki syntax which defines a table
  • secseparators will be configured to produce wiki syntax which creates a table row. The first column will always contain a hyperlink to the article of the query result (except you set the link header to '-' as described above.
  • multisecseparators will be configured to produce wiki syntax which creates another table row for multiple occurrences of the first include argument. For all other arguments a linebreak will be used if we are dealing with template parameters and a horizontal separation line will be used when dealing with chapter contents. The background for this is the following: If you have an article which calls the same template several times, you may want to have a table where each template invocation becomes a row in your table.

When using phantom templates (i.e. templates which are called during DPL execution instead of the original template) they must be written to produce output according to wiki table syntax. When entering such a template we are already at the beginning of a column (i.e. a preceding line with a | has already been put into the output stream). So start directly with the contents of the first column. To add more columns use a | in a separate line. Example:

   some output for the first column: {{{1|}}}
   |
   some output for the next column: {{{2|}}}
   |
   some output for the next column: {{{3|}}}

It may sound complicated, but is a huge improvement compared to the native use of mode, listseparators, secseparators and multisecseparators.

A typical DPL statement using the table parameter would contain:

include =                          #Chapter X,{T1}:parm1,#Chapter Y,{T2}.dpl
table   = class=sortable, Article,      X    ,     t-p  ,     Y    , T2-a, T2-b
 

Note that we have written the above statement in a way to show the correspondence between include and table. You can see the first two parameters which define the table characteristics and a headline for the hyperlink to the article. Then follow headlines for each argument of include. Note that there are TWO headlines which correspond to the last argument of the include statement (assuming that Template:T2.dpl outputs TWO columns). Template:T2 itself might have more or less than 2 arguments -- it only matters how many columns are output by Template:T2.dpl).

tablerow[edit]

tablerow

a simple syntax to create customized tabular output; see also table

Syntax:

tablerow=coldef, ..

Where coldef contains wiki code which uses the symbol '%%' to refer to the corresponding element of an include statement.

The table statement (which must be used as a prerequisite for tablerow) cares for the basics of table generation. So, when you define a column definition, you only need to specify the code for the field contents itself. You can start with field attributes like "bgcolor" or skip them. You can add a leading \n or to make sure that the field contents are displayed correctly if it contains wiki syntax that depends on linebreaks (e.g. enumeration list).

You must specify all columns. i.e. you must have as many entries in the tablerow statement as there are columns in your table. Skipping a column would suppress output for that column completely.

Table cells are split by the ¦ symbol if using the parser function ({{#dpl: }}) notation. A regular pipe | symbol can be used only if using the parser extension (<dpl> </dpl>) notation.

The tablerow command is best explained by an example:

{{#dpl:
| category = Destiny's Edge
| category = Legendary NPCs
| count=4
| include = {NPC infobox}:profession,#Early years[50]
| table = ,Title,Profession (from NPC infobox),"Early years" Section (50 chars)
| tablerow = style="background-color:lightyellow;"¦%%,¦%%,
}}
Title Profession (from NPC infobox) "Early years" Section (50 chars)
Caithe Thief

When the sylvari race was young, most of the ..→

Eir Stegalkin Ranger

Much of Eir's earlier history is unknown. What ..→

Zojja Elementalist

Zojja's early life is not well known. She became ..→

Rytlock Brimstone Warrior, Revenant

As a cub, Rytlock was the youngest of the ..→

tablesortcol[edit]

tablesortcol

define a column to be used as sort key (see also table )

Syntax:

tablesortcol=number

number is the position of the column that shall be used as sortkey when the result is initially displayed.

  • column numbering starts with 1;
  • tablesortcol = 0 means do not sort; this is the default.
  • Negative numbers are used to sort in descending order; e.g. -3 would sort according to the third column in descending order.
  • Note that the rest of the row after the selected column will also be part of the sortkey; so the contents of successive columns may serve as a secondary sort criterion if there are identical values in the selected column.
  • Also note that the whole column contents is taken; this may include hidden contents or markup sequences if you used column formatting commands. For the same reason you cannot expect numeric contents to be sorted 'numerically' - sorting will always be alphabetical.
  • you can of course use something like 'class=sortable' together with tablesortcol. The difference is that ..
    • interactive sorting only works after the article has been initially displayed
    • interactive sorting tries to guess the content type of a column and sorts according to that (date, number, string)
  • If you do not use tablesortcol the output order of your table rows will depend on the sort order by which the articles were analysed. That order depends on other DPL commands like ordermethod. The default is "alphabetically by title". So, without tablesortcol you get the tablerows in alphabetical sequence of the article names where they come from. With tablesortcol you can order them by the column contents itself.

Heading mode[edit]

headingmode[edit]

headingmode

To control the output of the headings in a DPL with complex/multi-parameter ordermethod. (No effect with single-param ordermethods.) For ordermethod=method1,method2,..., method1 is used for headings. E.g. headingmode affects category headings in ordermethod=category,title (2-param ordermethod). See also headingcount

Syntax:

headingmode=modename

modename can be one of:

  • none — headings are not displayed, no heading — (default)
  • unordered — outputs an unordered list — HTML tag ul
  • ordered — outputs an ordered list — HTML tag ol
  • definition — outputs a definition list — HTML tag dl
  • H2 — outputs sections — HTML tags H2 Currently broken
  • H3 — outputs sections — HTML tags H3 Currently broken
  • H4 — outputs sections — HTML tags H4 Currently broken

Example:

<dpl>
  category=Asura|Sylvari
  notcategory=Games
  nottitlematch=%disambiguation%
  count=7
  ordermethod=category,title
  headingmode=definition
  mode=ordered
</dpl>

This list will output pages that belong to one of the categories (Asura or Sylvari) in a list similar to this (HTML source). The categories are listed in sorted order, and the titles are replaced with the appropriate links (nottitlematch and count are simply used to reduce the output size):

(HTML) Output
<dl>
  <dt>Category</dt>
  <dd>
    <ol>
      <li>Page1</li>
      <li>Page2</li>
    </ol>
  </dd>
</dl>

Headingmode can be used with multi-column output but the length of the columns may in this case vary more than you would expect.

headingcount[edit]

headingcount

In combination with headingmode this parameter decides whether we show a text line with the number of articles per group or not.

Syntax:

headingcount=true

default is headingcount=false

listattr[edit]

listattr

Adds attributes to HTML list elements, depending on mode (HTML element is ol for ordered, ul for unordered, div for others). Can be used with pseudo mode=inline where inline text contains one or more <br/>. Only applicable to mode=ordered or mode=unordered.

Not applicable to mode=category or mode=inline (with no <br/> in inline text).

Syntax:

listattr=attribute1="val1" attribute2="val2" ...

Examples:

Input (HTML) Output
<dpl>
category=Asura|Sylvari
ordermethod=category,title
headingmode=definition
mode=none
listattr= class="submenul" class="dpl light-background"
itemattr= class="submenuli" style= "font-style: italic;"
</dpl>
<ol>
  <li class="submenul" class="dpl light-background"> Cat1 (link)
    <div class="submenul">
      <span class="submenuli" style="font-style: italic;"> Page1_1 </span> <br/>
      <span class="submenuli" style="font-style: italic;"> Page1_2 </span>
    </div>
  </li>
  <li class="submenul" class="dpl light-background"> Cat2 (link)
    <div class="submenul">
      <span class="submenuli" style="font-style: italic;"> Page2_1 </span> <br/> 
      <span class="submenuli" style="font-style: italic;"> Page2_2 </span>
    </div>
  </li>
</ol>
<dpl>
category=Asura|Sylvari
ordermethod=category,title
headingmode=definition
mode=unordered
listattr= class="submenul" class="dpl light-background"
itemattr= class="submenuli" style= "font-style: italic;"
</dpl>
<ol>
  <li> Cat1 (link)
    <ul class="submenul" class="dpl light-background">
      <li class="submenuli" style="font-style: italic;"> Page1_1 </li> 
      <li class="submenuli" style="font-style: italic;"> Page1_2 </li>
    </ul>
  </li>
  <li> Cat2 (link)
    <ul class="submenul" class="dpl light-background">
      <li class="submenuli" style="font-style: italic;"> Page2_1 </li> 
      <li class="submenuli" style="font-style: italic;"> Page2_2 </li>
    </ul>
  </li>
</ol>

itemattr[edit]

itemattr

Adds attributes to HTML list items, depending on mode (element is li for ordered/unordered, span for others).

Not applicable to mode=category.

Syntax:

itemattr=attribute1="val1" attribute2="val2" ...

hlistattr[edit]

hlistattr

Adds attributes to the HTML list element at the heading/top level, depending on headingmode (HTML element would be ol for ordered, ul for unordered, dl for definition, div for others)

Not yet applicable to headingmode=none.

Syntax:

hlistattr=attribute1="val1" attribute2="val2" ...

Example:

Input (HTML) Output
<dpl>
category=Asura|Sylvari
ordermethod=category,pagetouched
headingmode=definition
mode=ordered
hlistattr= class="topmenul" id="dmenu" style= "font-size:17px;"
</dpl>
<div class="topmenul" id="dmenu" style="font-size:17px;">
  <li> Category 2 (link) </li>
  <ol>
      <li>Page1_1</li>
      <li>Page1_2</li>
  </ol>
  <li> Category 2 (link) </li>
  <ol>
      <li>Page2_1</li>
  </ol>
</div>

These examples compare listattr, itemattr, and hlistattr

Input
<dpl>
category=Asura|Sylvari
ordermethod=category,title
headingmode=definition
mode=unordered
listattr= class="submenul" class="dpl light-background"
itemattr= class="submenuli" style= "font-style: italic;"
</dpl>
<dpl>
category=Asura|Sylvari
ordermethod=category,title
headingmode=definition
mode=unordered
listattr= class="submenul"
itemattr= class="submenuli" class="dpl light-background" style= "font-style: italic;"
</dpl>
<dpl>
category=Asura|Sylvari
ordermethod=category,title
headingmode=definition
mode=unordered
hlistattr= class="topmenul" id="dmenu" class="dpl light-background"
listattr= class="submenul"
itemattr= class="submenuli" style="font-style: italic;"
</dpl>

See also hitemattr.

hitemattr[edit]

hitemattr

Adds attributes to HTML list items (headings) at the heading level, depending on headingmode (HTML element would be li for ordered/unordered, div for others).

To be used with headingmode='unordered' or 'ordered'. (Not yet applicable for others.)

Syntax:

hitemattr=attribute1="val1" attribute2="val2" ...

Example:

Input (HTML) Output Intended Output Actual Output
<dpl>
category=Asura|Sylvari
ordermethod=category,title
headingmode=unordered
mode=ordered
hlistattr= class="topmenul" id="dmenu"
hitemattr= class="topmenuli" class="dpl light-background"
</dpl>
<ul class="topmenul" id="dmenu">
  <li class="topmenuli" class="dpl light-background"> Category 1 (link)
    <ol>
      <li>Page1_1</li>
      <li>Page1_2</li>
    </ol>
  </li>
  <li class="topmenuli" class="dpl light-background"> Category 2 (link)
    <ol>
      <li>Page2_1</li>
    </ol>
  </li>
</ul>
  • Category 1 (link)
    1. Page1_1
    2. Page1_2
  • Category 2 (link)
    1. Page2_1

userdateformat[edit]

userdateformat

Define a special layout for date formatting.

Syntax:

userdateformat=formatstring

The formatstring may contain letters like "y,Y,m,M,d,D,h,H,i,I,s" for year, month day. Other characters are printed as they are. See the documentation for php function date() for more details [1]. The userdateformat applies to all date/time fields, see the parameters: addeditdate,addpagetoucheddate,addfirstcategorydate.

Example:

userdateformat=Y-m-d (D)

Default:

By default DPL uses "Y-m-d H:i:s" to display date and time. Note that MediaWiki stores all dates/times in UTC format. When displaying a time stamp DPL will translate it according to

  1. the timezone preference (difference to UTC/GMT) given by the user in his user settings.
  2. if no preference is given and for all anonymous users the local time on the server will be used.

So you will either see a time based on your local time (browser based) or based on the timezone in which the wiki server is running.

The same kind of translation applies to dates you specify when selecting articles by revsion date/time.

Control the way article names are displayed[edit]

shownamespace[edit]

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      = Help
  namespace     = Help_talk
  shownamespace = false
</dpl>

This list will output all Talk pages in Category:Help, listed without the 'Help talk:' prepended to page names.
The namespace 'Talk' refers to talk pages within the main namespace; all other talk namespaces, such as 'Help' or 'Guide' talk pages, would need the format 'namespace_talk'.
Only talk pages that have been added to the category (by placing [[Category:Help]] on the talk page) will be listed.


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%).

escapelinks[edit]

escapelinks

Regarding images and categories this parameter allows you to decide whether

  • you want to see a link to the image or to the category page (escapelinks=true, this is the default)
  • you want to see the image or make the page which contains the DPL statement part of the categories which are returned by DPL (escapelinks=false)

Syntax:

escapelinks=false

Note: You can use this parameter to show images; another way to do this is to use the gallery extension in combination with DPL.

titlemaxlength[edit]

titlemaxlength

To limit the number of characters of the title to display. If the page title (this does not include the namespace or any other prefix before the title) is bigger than the titlemaxlength value, the title is truncated and ended by '...'.

Syntax:

titlemaxlength=number of characters

replaceintitle[edit]

replaceintitle

execute a string replacement operation on the %TITLE% var

Syntax:

replaceintitle=search for,replacement

The search for argument must be an expression which can be used in a php preg_replace() function call.

Example:

to remove the string "demo" in article names, you must write

replaceintitle=/demo/,

Note that standard regexp rules apply. The regexp must start with a non-alphanumeric character -- but not with a backslash! It is good habit to use a '/' if this character is not needed within the regexp itself. Read the php manual to understand the details of regular expressions.

Arranging article lists in columns and rows[edit]

columns[edit]

columns

Define a column layout for the output.

Syntax:

columns=ncols

Example:

<dpl>
  category	  = Help
  nottitlematch	  = %DPL%
  includesubpages = false
  columns	  = 3
  rowcolformat	  = width=100%
  count		  = 6
</dpl>

Simply displays non-DPL articles and subcategories in Category:Help in 3 columns (rowcolformat is used to make the table width 100%).

Note: columns is currently bugged (possible combatibility issue between Mediawiki 1.31.2 and DPL3 v3.3.3) [1].
For a 3-column dpl, css can be used to achieve the desired results:

<div style="-webkit-column-count:3;column-count:3;">
<dpl>
  category	  = Help
  nottitlematch	  = %DPL%
  includesubpages = false
  columns	  = 3
  rowcolformat	  = width=100%
  count		  = 6
</dpl></div>

More complex example:

In mode=userformat the outer tags from listseparators will be repeated for each column.

<div style="-webkit-column-count:3;column-count:3;">
<dpl>
  category	  = Help
  nottitlematch	  = %DPL%
  includesubpages = false
  addpagesize	  = true
  ordermethod	  = size
  listseparators  = {|class=sortablewikitable id=2\n!Rank\n!Article\n!Bytes\n|-,\n|%NR%.\n|[[%PAGE%]]\n|style="text-align:right;"|%SIZE%,\n|-,\n|}
  columns	  = 2
  count		  = 6
</dpl></div>

This output contains a list of the largest non-DPL articles in Category:Help. Each column consists of a table which has itself three columns: rank, article name and size.

Rank Article Bytes
1. Help:WikiLove 1012
2. Help:Archiving 2050
3. Help:Redirect 2772
4. Help:Categories 2877
5. Help:Leaving article feedback 3304
6. Help:Templates 3685

rows[edit]

rows

Define a row layout for the output. A "row" is a group of output lines for which the heading is repeated. If you do not know how big your result will be, it may be better to use the rowsize parameter.

Syntax:

rows=nrows

In mode=userformat, the outer tags from listseparators will be repeated for each column. Thus you can create long lists where the table heading is repeated from time to time.

Example:

<dpl>
  category	  = Help
  nottitlematch	  = %DPL%
  includesubpages = false
  addpagesize	  = true
  ordermethod	  = size
  listseparators  = {|class=sortablewikitable id=2\n!Rank\n!Article\n!Bytes\n|-,\n|%NR%.\n|[[%PAGE%]]\n|style="text-align:right;"|%SIZE%,\n|-,\n|}
  rows		  = 2
  count		  = 6
</dpl>

The output will contain a list of the largest non-DPL articles in Category:Help, arranged in two rows (dividing the list of lines equally into 2). Each row consists of a table which has itself three columns: rank, article name, and size.

Rank Article Bytes
1. Help:WikiLove 1012
2. Help:Archiving 2050
3. Help:Redirect 2772
4. Help:Categories 2877
5. Help:Leaving article feedback 3304
6. Help:Templates 3685

rowsize[edit]

rowsize

Define a row layout for the output. A "row" is a group of n output lines for which the heading will be repeated.

Syntax:

rowsize=nrowsize

In mode=userformat the outer tags from listseparators will be repeated after each group of rowsize output lines. Thus you can create long lists where the table heading is repeated in regular intervals.

Example:

<dpl>
  category	  = Help
  nottitlematch	  = %DPL%
  includesubpages = false
  addpagesize	  = true
  ordermethod	  = size
  listseparators  = {|class=sortablewikitable id=2\n!Rank\n!width=200px|Article\n!Bytes\n|-,\n|%NR%.\n|[[%PAGE%]]\n|style="text-align:right;"|%SIZE%,\n|-,\n|}
  rowsize	  = 3
  count		  = 6
</dpl>

The output will contain a list of all non-DPL articles in Category:Help. After each group of 3 entries (article names) the table heading will be repeated. It may be useful to set the width of the column with the article names explicitly, so that the tables in each row have equal width.

Rank Article Bytes
1. Help:WikiLove 1012
2. Help:Archiving 2050
3. Help:Redirect 2772
4. Help:Categories 2877
5. Help:Leaving article feedback 3304
6. Help:Templates 3685

rowcolformat[edit]

rowcolformat

Defines layout properties (using HTML table tag parameters) for the row/column grid.

Syntax:

rowcolformat=html tags

Example:

<dpl>
  category	  = Help
  nottitlematch	  = %DPL%
  includesubpages = false
  columns	  = 3
  rowcolformat	  = cellspacing=20
  count		  = 6
</dpl>

There will be more space around the columns than normal. See columns above for another example.

The ideal way to use rowcolformat is to assign a CSS class to your DPL table which has been defined in your mediawiki:Common.css article.

Example:

<dpl>
  category	  = Help
  nottitlematch	  = %DPL%
  includesubpages = false
  columns	  = 3
  rowcolformat	  = class=dpl3columns
  count		  = 6
</dpl>

In your Common.css article you might have written something like

table.dpl3columns td {
  background: #f2f2f2;
  padding: 0.5em;
  border: 3px;
  width: 33%;
}

Defining header and footer for the result[edit]

resultsheader[edit]

resultsheader

output a headline if there is at least one article to display.

Syntax: resultsheader=some wiki text

Notes:

  • The symbol %PAGES% will be replaced by the number of pages found. If your query result is limited (by system settings or by the count parameter) %PAGES% will only show the upper limit.
  • The symbol %TOTALPAGES% will be replaced by the number of pages found - regardless of count limits. This may consume extra resources.
  • %VERSION% will be replaced by the current DPL version.
  • 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.
  • If 'oneresultheader' is specified as well, the latter will be used in case there is exactly 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.
}}

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[edit]

resultsfooter

output a summary 'footline' if there is at least one article to display.

Syntax: resultsfooter=some wiki text

Note: The rules of #resultsheader apply here as well.

Example:

{{#dpl:
|category=Africa
|mode=userformat
|resultsfooter=\n===There are %PAGES% pages on Africa.===\n
}}

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 #resultsheader.

oneresultheader[edit]

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. %VERSION% will be replaced by the current DPL version. 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.

oneresultfooter[edit]

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. %VERSION% will be replaced by the current DPL version. This is useful if you want to use wiki markup which needs to start at the begin of a line.

noresultsheader[edit]

noresultsheader

output a headline if there is no article to display (empty result).

Syntax: noresultsheader=some wiki text

Note:

Setting noresultsheader to a single blank or to a newline character ("noresultsheader=&nbsp;" or "noresultsheader=\n") will suppress the warning message from DPL which is normally issued if no articles were found. Example:

A)
{{#dpl:
|titlematch=nosuchArticle
}}

B)
{{#dpl:
|noresultsheader=&nbsp;
|titlematch=nosuchArticle
}}

C)
{{#dpl:
|noresultsheader=No results were found
|titlematch=nosuchArticle
}}

This produces:

A)


B)  

C) No results were found

suppresserrors (DEPRECATED)[edit]

This parameter is deprecated and is left in the code as a null parameter to give people time to remove it from their queries. It will be fully removed in a future release of DPL.

suppresserrors

suppress the warning message if no matching article was found.

Syntax: suppresserrors=true

See also: Help:DPL/manual/other parameters#debug.

Note: Setting suppresserrors to true has the same effect as setting noresultsheader to a single space character. The command is provided for downward compatibility reasons with older DPL versions.

noresultsfooter[edit]

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 ..

Adding meta data to the output[edit]

addcategories[edit]

addcategories

Shows all categories to which an article belongs as a small text line after the article name.

Example:

{{#dpl:
|category       = DPL3
|addcategories  = true
}}


This will show all DPL pages together with a list of categories per article. Of course "DPL" 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[edit]

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
|count          = 5
}}

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[edit]

addpagesize

Shows the size of the page.

Example:

{{#dpl:
|category       = Africa
|ordermethod    = size
|order          = descending
|addpagesize    = true
|counter        = 5
}}

This will show the 5 biggest articles about Africa.

Note: in 'mode=userformat' the size can also be referenced as a built-in variable.

addcontribution[edit]

addcontribution

shows how much a user contributed to an article.

Syntax:

addcontribution=true

If omitted, the default is false.

Using this parameter will restrict your output to articles which were edited recently (This is usually one week or one month, according to the setup of your wiki).

You will get a link to the contributor and an "asterisk bar" which indicates how many bytes in the article were changed by that user.

You will also have the built-in variables %CONTRIBUTOR%, %CONTRIB% and %CONTRIBUTION% available to be used in your own format statement.

adduser[edit]

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
}}

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[edit]

addauthor

show the user who created the article

Syntax:

addauthor=true

If omitted, the default is false.

Example:

{{#dpl:
|category    = Africa
|addauthor   = true
}}

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[edit]

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[edit]

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
}}

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 %DATE%. The formatting of the date can be influenced using userdateformat. The date is translated to your local time zone (if defined in your preferences) or to the server's time zone.

addeditdate[edit]

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
}}

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 %DATE%. The formatting of the date can be influenced using userdateformat. The date is translated to your local time zone (if defined in your preferences) or to the server's time zone.

addexternallink[edit]

addexternallink

add the URL of an external link to the output list.

Purpose:

Allows to display external links found in articles.

Example:

addexternallink=true

If omitted, the default is false.

Note: The command makes only sense in combination with linkstoexternal.

addfirstcategorydate[edit]

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
}}

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 %DATE%. The formatting of the date can be influenced using userdateformat. The date is translated to your local time zone (if defined in your preferences) or to the server's time zone.

showcurid[edit]

showcurid

page links will contain the current page id

Example:

showcurid=true

If omitted, the default is false.

Example:

{{#dpl:
|category             = Africa
|showcurid            = true
}}

This DPL command will output a list of pages belonging to [[Category:Africa]]; the hyperlinks to these pages look normal, but they have an additional parameter named 'curid' which contains the numeric id of the linked page. Using this type of link may be somewhat faster than using the title only. This kind of link is useful for some web spiders (e.g. google spider needs a unique id within the pagelink) and it works even if the title has moved.

showcurid=true cannot be used together with openreferences=true.

Include contents from the articles in the result set[edit]

include[edit]

include

include pages (whole content) or include certain sections of articles or template parameters. 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.

With include you can incorporate one or more of the following

  • the whole article as it is
  • a certain chapter -- identified by its headline
  • a certain chapter -- identified by its position (sequence number, regardless of level)
  • parameter(s) used in template calls
  • the output of a surrogate template (phantom template) which is used instead of the original template
  • pieces of text which are marked by special section markers

There is a close correlation between the output of the include statement and table and tablerow. You should understand those statements if you want to create tabular output from included content.

Syntax:

include whole article[edit]

To include a whole page, use a wildcard:

include=*
you can use includemaxlength=[n] to restrict the included text to a portion of the article. The text is truncated in a way which will not spoil tag structures or bracket nestings. It will be cut at a word boundary if possible.

include chapters[edit]

To include sections (chapters) by a reference to their heading: 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.

  • Normally your text pattern will be compared literally and it must match the whole headline of the chapter. If you use a double hash sign (##), however, the text will be taken as a regular expression. It will automatically be enclosed within slashes and the matching will be case insensitive and will refer to the headline as a whole (^regexp$). So if you only want to match part of the text you must add ".*" around your pattern. It is your responsibility to provide correct regexp syntax. Otherwise you may see runtime errors, get no output etc.
include = ##.*omethin.*
The above will match a Headline like "This is something old" or "That Was Something Old".
  • Instead of the #-sign the @-sign can be used (the # lead to problems in certain cases); @@ will act as a regexp comparison just as ## does.
  • Add one or more optional filter expressions, a character limit and/or an optional link text in square brackets to shape the included portion of text : [filter 1~...~filter n~limit text].
    • the filters will be applied before calculating the length of the text; they simply throw away the matching part of the contents.
    • If the remaining text is longer than the limit, it will be cut and a link will appear which points directly to the chapter which was included. Using "1" as a limit will only show the link (if the corresponding chapter in the article is not empty), "0" will not show anything, not even the link. When truncating included text portions care is taken not to spoil wiki syntax (i.e. maintain a symmetry of brackets and braces, make sure that nowiki and pre tags are balanced). Therefore, the size of the included text can deviate from what you specified.
  • If there is no chapter with the specified heading the output will be empty.
include = #heading1,#heading2[filter~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.
  • 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. Chapters 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.
include = %1[100]

includes the first 100 characters of the first chapter

include contents related to templates[edit]

  • You can include the result of a template call by specifying the template name within curly braces. So, include={my template} will display the result of the template call with the original parameters used on the selected article page.

Note that you need a space char or a line break after this statement before ending the #dpl parser function call because otherwise the MW parser may be fooled by three successive closing curly braces.

  • MediaWiki treats spaces like underscores. Therefore {my template} will also match a template invocation like {{My_template|...}}.
  • MediaWiki searches for template calls in the template namespace. Specifying {my template} will also match a template invocation like {{Template:My_template|...}}.
  • Using a different namespace also works: {Xyz:my template} will match a template invocation in namespace Xyz. {:my template} will match a template invocation in the main namespace like {{:my template|...}}.
  • You can include one or more parameters of a template call by specifying a list of names or position numbers separated by colons (and optional white space). Names are use for named parameters, numbers for positional parameters.
include={animal}:age:size:1
This will include the values of the two parameters named 'age' and 'size' and the value of the first unnamed parameter in all calls of the template "animal".

It is even possible to use expressions which contain a % symbol as pseudo parameters:

include={animal}:age:%PAGE%:size:1
This will output the page name after the 'age'; this is useful in combination with the table statement when using a '-' symbol as the second argument for 'table'. This combination makes it possible to produce a list where the link to the article need not be in the first column; enclosing the %PAGE% in double square brackets would create a link, see the second example in Test table
  • Instead of collecting parameter values you can include the output of a 'surrogate' template (also called a 'phantom template'). DPL calls this template instead of the original template with the identical parameter list (plus the two additional parameters %PAGE% and %TITLE%). You will get the output of the surrogate template. To make this happen you specify the name of a template within single curly braces and add a suffix. As said before, 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 five additional parameters to each template, called
    • %PAGE%
    • %TITLE%
    • %DATE%
    • %USER%
    • %CATLIST%

They allow the template to produce a link to the source file from where it was included, show the date from the DPL query (e.g. lasteditdate) and show the user from the query (e.g. the user who made the last edit).
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.
  • There is an alternate syntax to specify a surrogate template. It has the advantage that the surrogate template may reside in a different namespace than the original template. Also, the surrogate template's name can be completely different from the original template name: {template¦surrogate template}. For example, you may specify something like {my template¦Help:Substitution for my template}.

include parser function calls[edit]

  • if you specify a pattern like {#pfunc}.list DPL will look for calls of the parser function 'pfunc'. DPL will pass the parameters of this parser function to a template which you have to provide under the name of 'Template:pfunc.list'. Instead of '.list' you can use your own suffix. The Template will receive the parser function name as %PFUNC% and all parameters under their normal name or number. Instead of specifying a single parser function you can also use a generic pattern. See DPL Example 026. Note that this function is not very robust. It cannot handle nested parser functions properly.

include parser extension calls[edit]

  • if you specify a pattern like {~func}.list DPL will look for calls of the parser extension with the tag name <func>. DPL will pass the body of the tag structure to a template which you have to provide under the name of 'Template:func.list'. Instead of '.list' you can use your own suffix. The Template will receive the function name as %TAG% and the body will be named %TAGBODY%. See DPL Example 028. Note that this function is not very robust. It cannot handle nested tags properly.

include specially labeled text portions[edit]

  • To include sections which are labeled with special tags you just mention the tag name. Refer to Labeled Section Transclusion for details on how to label sections in your pages accordingly:
include=sec1,sec2,...

If the section name starts with a '*' the asterisk will be cut off and the rest of the text will be taken as a regular expression. If the section name is '**' it will match all section names. In both cases the tag name will precede the output, separated by '::'.

See Test:section inclusion

include nothing[edit]

  • To include nothing from the page (no inclusion), leave blank (this is default):
include=
  • A single '-' sign has the same effect; such a dummy parameter can be useful if you want to put content into columns of the output table which is not derived from the include statement

combinations of the above possibilities[edit]

All of the above can be combined, you can even refer to the same template or heading more than once.

include = {template1}suffix1,{template1}:p1:p2:2,#headline,marker,....

Example: include = 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.

See also: Help:DPL/manual/page selection#includematch.

includepage[edit]

includepage

this can be used as a longer name for include.

includemaxlength[edit]

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.

includetrim[edit]

includetrim

removes all leading and trailing whitespace from transcluded contents.

Syntax:

includetrim=true (default is false)

Note: this parameter is only useful in combination with include=.

References[edit]