Gamepedia Help Wiki
Register
No edit summary
(→‎hlistattr: the <pre>'d example text did not match what was actually being queried for the 3rd example)
(39 intermediate revisions by 14 users not shown)
Line 1: Line 1:
{{DPL Manual|section=Parameters|subsection=Controlling Output Format}}
+
{{DPL manual|section=Parameters|subsection=Controlling output format}}
  +
<div id="dpl">
  +
{{tocright}}
  +
You can select one of several default formats or define your own format ({{dpl3|mode|=userformat}}); output can be grouped in columns or rows.
   
  +
In the examples that follow, the DPL output has been kept small to reduce page load time and page size, most notably using {{dpl3|titlematch}}, {{dpl3|nottitlematch}}, {{dpl3|count}}, and {{dpl3|includesubpages|=false}}.
You can select one of several default formats or define your own format (<tt>[[#mode|mode=userformat]]</tt>); output can be grouped in columns or rows.
 
   
 
== General approach to output formatting ==
 
== General approach to output formatting ==
Line 7: Line 10:
 
The general approach to output formatting is two-fold:
 
The general approach to output formatting is two-fold:
   
# There are a couple of simple predefined output formats which generate lists of articles
+
# There are a couple of simple predefined output formats which generate lists of articles.
#:You will understand their meaning directly from reading
+
#:You will understand their meaning directly from reading.
# There is a mode called "userformat" which puts complete control into your hands
+
# There is a mode called {{dpl3|userformat}} which puts complete control into your hands.
 
#:This is somewhat complicated.
 
#:This is somewhat complicated.
   
While the standard output formats are meant to be used for fast generation of simple page lists,
+
While the standard output formats are meant to be used for fast generation of simple page lists, the {{dpl3|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.
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:
+
We assume that we have two documents which use templates {{tt|x}} and {{tt|y}} with varying arguments; while {{tt|x}} is being used once within each document, {{tt|y}} is used several times. In very short notation the structure might look as follows:
  +
<pre style="padding-left:5px; width:30%">
 
A: x(a) y(3) y(5)
 
A: x(a) y(3) y(5)
B: x(b) y(4) y(1) y(2)
+
B: x(b) y(4) y(1) y(2)</pre>
   
 
The following DPL parameters are used to define a set of tags which are used to construct the output:
 
The following DPL parameters are used to define a set of tags which are used to construct the output:
* <tt>[[listseparators]]</tt> = liststart,itemstart,itemend,listend
+
* {{dpl3|listseparators}} = ''liststart'',''itemstart'',''itemend'',''listend''
* <tt>[[secseparators]]</tt> = sec-1-start,sec-1-end,sec-2-start,sec-2-end, .. , ..
+
* {{dpl3|secseparators}} = ''sec-1-start'',''sec-1-end'',''sec-2-start'',''sec-2-end'', .. , ..
* <tt>[[multisecseparators]]</tt> = multi-sep
+
* {{dpl3|multisecseparators}} = ''multi-sep''
The arguments of the above statements can contain '''references to %VARIABLES%'''. So ''sec-1-start'' might contain a reference like <tt>%PAGE%</tt> to output the page name. See [[format]] for more details on variable substitution.
+
The arguments of the above statements can contain '''references to {{dpl3|VARIABLES|%VARIABLES%}}'''. So ''sec-1-start'' might contain a reference like {{tt|%PAGE%}} to output the page name. See {{dpl3|format}} for more details on variable substitution.
   
 
Now think of the following page inclusion statement:
 
Now think of the following page inclusion statement:
  +
<pre style="padding-left:5px; width:30%">
includepage={x}.dpl,{y}.dpl
 
  +
includepage={x}.dpl,{y}.dpl</pre>
   
 
The output will then look like this:
 
The output will then look like this:
  +
<pre style="padding-left:5px; width:30%">
 
liststart
 
liststart
 
itemstart
 
itemstart
Line 52: Line 57:
 
sec-2-end
 
sec-2-end
 
itemend
 
itemend
listend
+
listend</pre>
 
Assuming that the tags (<tt>liststart</tt>, <tt>itemstart</tt>, etc.) contain wiki syntax for table definitions and multi-sep defines a horizontal line, the output might look like this:
 
   
  +
Assuming that the tags ({{tt|liststart}}, {{tt|itemstart}}, etc.) contain wiki syntax for table definitions and {{tt|multi-sep}} defines a horizontal line, the output might look like this:
  +
<pre style="padding-left:5px; width:30%">
 
+------+---------------------+
 
+------+---------------------+
 
| | | y.dpl(3) |
 
| | | y.dpl(3) |
Line 66: Line 71:
 
| | | ---- |
 
| | | ---- |
 
| | | y.dpl(2) |
 
| | | y.dpl(2) |
+------+----------+----------+
+
+------+----------+----------+</pre>
 
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.
 
   
  +
In some situations, however, you may want to create an output table where each of the calls of template {{tt|y}} is used to create a separate output row. Using a sortable table you could then easily rearrange the output.
  +
<pre style="padding-left:5px; width:50%">
 
+------+---------------------+ +------+---------------------+
 
+------+---------------------+ +------+---------------------+
 
| A | x.dpl(a) | y.dpl(1) | | B | x.dpl(b) | y.dpl(1) |
 
| A | x.dpl(a) | y.dpl(1) | | B | x.dpl(b) | y.dpl(1) |
Line 80: Line 85:
 
+------+---------------------+ +------+---------------------+
 
+------+---------------------+ +------+---------------------+
 
| B | x.dpl(b) | y.dpl(5 | | B | x.dpl(b) | y.dpl(5) |
 
| B | x.dpl(b) | y.dpl(5 | | B | x.dpl(b) | y.dpl(5) |
+------+---------------------+ +------+---------------------+
+
+------+---------------------+ +------+---------------------+</pre>
  +
 
There is a special parameter called <tt>[[dominantsection]]</tt> which you can use to mark one section of your <tt>[[includepage]]</tt> statement as "dominant" (in our example: <tt>dominatsection=2</tt> as {y}.dpl is the second argument of our <tt>includepage</tt> 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.
+
There is a special parameter called {{dpl3|dominantsection}} which you can use to mark one section of your {{dpl3|includepage}} statement as "dominant" (in our example: {{dpl3|dominantsection|=2}} as {{tt|{y}.dpl}} is the second argument of our {{dpl3|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 (<tt>[[table]], [[tablerow]]</tt>) which make it fairly easy to create tabular output.
+
As all of the above is not very easy to understand there are additional DPL commands ({{dpl3|table}}, {{dpl3|tablerow}}) which make it fairly easy to create tabular output.
   
 
== Setting the basic output mode ==
 
== Setting the basic output mode ==
Line 91: Line 96:
 
===mode===
 
===mode===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = mode
 
|name = mode
 
|purpose= Provide basic control over the output of DPL.
 
|purpose= Provide basic control over the output of DPL.
Line 98: Line 103:
 
Syntax:
 
Syntax:
   
<code>mode=<i>modename</i></code>
+
{{DPL syntax|mode=''modename''}}
   
 
<u>''modename'' can be one of:</u>
 
<u>''modename'' can be one of:</u>
   
;''unordered'': outputs an unordered list &mdash; HTML tag "ul" &mdash; '''(default)'''
+
;''unordered'': outputs an unordered list &mdash; HTML tag {{tt|ul}} &mdash; '''(default)'''
;''ordered'': outputs an ordered list &mdash; HTML tag "ol"
+
;''ordered'': outputs an ordered list &mdash; HTML tag {{tt|ol}}
;''none'': outputs a list using newlines and HTML tags "br" to separate each item
+
;''none'': outputs a list using newlines and HTML tags {{tt|br/}} to separate each item
;''inline'': outputs a list using symbol defined by the <tt>[[#inlinetext|inlinetext]]</tt> parameter to separate items.
+
;''inline'': outputs a list using symbols defined by the {{dpl3|inlinetext}} parameter to separate items
;''category'': outputs resulting articles in a way category-pages are shown ('''you have to use <code>[[ordermethod]] = title | titlewithoutnamespace | category,title | user,title</code> with this option!''')
+
;''category'': outputs resulting articles in a way category-pages are shown ('''you must use {{dpl3|ordermethod| =&nbsp;title / titlewithoutnamespace / category,title / user,title}} with this option!''')
   
;''userformat'': will leave output control completely to the user; <br> see parameter <tt>[[listseparators]]</tt> and <tt>[[secseparators]]</tt>; in this mode DPL2 will offer 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.
+
;''userformat'': will leave output control completely to the user; <br/> see parameters {{dpl3|listseparators}} and {{dpl3|secseparators}}; in this mode DPL offers built-in variables which must be referenced in the output format description provided by the user. '''{{dpl3|mode|=userformat}}''' is quite important to have complete control over the output.
   
For advanced use of DPL it is important to understand <tt>mode=userformat</tt>. Note that this mode is '''automatically implied''' when <tt>listseparators=</tt> or <tt>[[#Format|format]]=</tt> are used.
+
For advanced use of DPL it is important to understand {{dpl3|mode|=userformat}}. Note that this mode is '''automatically implied''' when {{dpl3|listseparators|=}} or {{dpl3|format|=}} are used.
   
====Example1====
+
==== mode 'ordered', 'unordered', 'none' (Example1) ====
  +
These create abbreviated lists of [[:Category:DPL3]] pages:
 
  +
<!-- originally, Example, category=Africa, and there was no titlematch -->
<table><tr valign=top><td>
 
  +
{| style="border-spacing: 10px 0;"
<pre><nowiki>
 
  +
| align=center| In an {{tag|ol}} list: || align=center| In a {{tag|ul}} list: || align=center| In a {{tag|br/|open}} list:
{{#dpl:
 
  +
|- style="vertical-align:middle;"
|category=Africa
 
  +
|<pre><nowiki>
|mode=ordered
 
  +
<dpl>
}}
 
  +
category=DPL3
  +
titlematch=%o%
  +
nottitlematch=%nt%|%ow%|%ec%
  +
mode=ordered
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
  +
|<pre><nowiki>
  +
<dpl>
  +
category=DPL3
  +
titlematch=%o%
  +
nottitlematch=%nt%|%ow%|%ec%
  +
mode=unordered
  +
</dpl>
  +
</nowiki></pre>
  +
|<pre><nowiki>
  +
<dpl>
  +
category=DPL3
  +
titlematch=%o%
  +
nottitlematch=%nt%|%ow%|%ec%
  +
mode=none
  +
</dpl>
  +
</nowiki></pre>
  +
|-
  +
|<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) ====
<td>This list will output pages that have <nowiki>[[Category:Africa]]</nowiki> shown in an &lt;ol&gt;...&lt;/ol&gt; list:
 
  +
<!-- originally, Example2, titlematch=%frica% -->
 
<ol>
 
<li>Nigeria
 
<li>Sudan
 
<li>Zimbabwe
 
</ol>
 
</table>
 
 
====Example2====
 
 
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
|titlematch=%frica%
+
titlematch=%Help%
  +
includesubpages=false
|mode=category
 
  +
mode=category
|ordermethod=titlewithoutnamespace
 
  +
ordermethod=titlewithoutnamespace
}}
 
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
   
This list will output pages that have 'frica' 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)
+
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>
   
Related [[DPL extension variables]]: <code>$wgDPL2CategoryStyleListCutoff</code>.
 
   
  +
Related configuration option (see [https://www.mediawiki.org/wiki/Extension:DynamicPageList3 Extension:DynamicPageList3 on MediaWiki Wiki]: <code>$wgDPL2CategoryStyleListCutoff</code>.
   
== mode 'Inline' ==
+
==== mode 'inline' ====
   
===inlinetext===
+
=====inlinetext=====
   
{{DPL Parameter
+
{{DPL parameter
 
|name = inlinetext
 
|name = inlinetext
|purpose= To define the inline text used in <code>mode=inline</code>
+
|purpose= To define the inline text used in {{dpl3|mode|=inline}}.
 
}}
 
}}
   
 
Syntax:
 
Syntax:
   
<code>inlinetext=<i>wikitext</i></code>, with <i>wikitext</i> some wiki text
+
{{DPL syntax|inlinetext=''wikitext''}}, with ''wikitext'' as some wiki text;
'''default is '&amp;nbsp;-&amp;nbsp;'''' except for mode=userformat where inlinetext is empty by default.
+
'''default is <code>{{&|nbsp}}-{{&|nbsp}}</code>''' except for {{dpl3|mode|=userformat}} where {{dpl3|inlinetext}} is empty by default.
   
If you want normal "breaking spaces" (and not the NON-breaking spaces) you should use '&amp;#32;-&amp;#32;'.
+
If you want normal "breaking spaces" (and not the NON-breaking spaces) you should use <code>{{&|#32}}-{{&|#32}}</code>.
   
Extra whitespaces are stripped by DPL from the beginning and end of <i>wikitext</i>. If you want to show one or multiple spaces, use one or multiple '<code>&amp;nbsp;</code>', or use 'nowiki' tags like in '&lt;nowiki&gt; - &lt;/nowiki&gt;' which has same effect as '&amp;nbsp;-&amp;nbsp;'.
+
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 <code>{{&|nbsp}}</code>, or use 'nowiki' tags {{tag|nowiki|p|&nbsp;-&nbsp;}} which has the same effect as <code>{{&|nbsp}}-{{&|nbsp}}</code>.
  +
  +
Bullets can be displayed with either <code>{{&|bull}}</code> or {{tl|*}}.
   
 
Example:
 
Example:
  +
<!-- originally, category=Africa -->
 
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
|category=Africa
+
category = Help
  +
includesubpages= false
|mode=inline
 
  +
count = 10
|inlinetext= &amp;nbsp; &amp;bull; &amp;nbsp;
 
  +
mode = inline
}}
 
  +
inlinetext = &amp;nbsp; &amp;bull; &amp;nbsp;
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
   
This list will output pages that have <nowiki>[[Category:Africa]]</nowiki> shown like Item1 &bull; Item2 &bull; Item3 &bull; ...
+
This list outputs pages that have [[:Category:Help]] shown like Item1 &bull; Item2 &bull; Item3 &bull; ...
   
  +
<dpl>
== mode 'Userformat' ==
 
  +
category = Help
  +
includesubpages = false
  +
count = 10
  +
mode = inline
  +
inlinetext = &nbsp; &bull; &nbsp;
  +
</dpl>
   
  +
==== {{anchor|userformat}}mode 'userformat' ====
===listseparators===
 
  +
{{DPL Parameter
 
|name = listseparators (alias for format)
+
=====listseparators=====
|purpose= see the [[#Format|format]] parameter.
+
{{DPL parameter
  +
|name = listseparators
  +
|purpose= (alias for format) see the {{dpl3|format}} parameter. Implicitly sets {{dpl3|mode|=userformat}}.
 
}}
 
}}
Note that ''format='' automatically implies ''mode=userformat'' whereas <tt>listseparators</tt> does not.
 
   
===format===
+
=====format=====
   
{{DPL Parameter
+
{{DPL parameter
 
|name = format
 
|name = format
|purpose= customize the output format completely. Implicitly sets <tt>[[#mode|mode]]=userformat</tt>. Uses variable references like <tt>%PAGE%</tt> to describe the output format. See also the <tt>[[#secseparators|secseparators]]</tt> parameter.
+
|purpose= customize the output format completely. Implicitly sets {{dpl3|mode|=userformat}}. Uses variable references like {{tt|%PAGE%}} to describe the output format. See also the {{dpl3|secseparators}} parameter.
 
}}
 
}}
   
NOTE: <tt>listseparators</tt> is an alias for <tt>format</tt> which does not automatically imply <tt>mode=userformat</tt>.
+
Note1: {{dpl3|listseparators}} is an alias for {{dpl3|format}}.
   
NOTE: The <tt>format</tt> command is very flexible, but can be complicated to use. Creating tabular output is better done with the [[table]] command.
+
Note2: the {{dpl3|format}} command is very flexible but somewhat complicated. If you want to create tabular output, you should have a look at the {{dpl3|table}} command.
   
'''Syntax:'''
+
Syntax:
 
<code>format=Startall,Start,End,Endall</code>
 
   
'Startall', 'Start', 'End' and 'Endall' are wiki tags used to separate the list items.
+
{{DPL syntax|format=''Startall'',''Start'',''End'',''Endall''}}
* 'Startall' and 'Endall' define an outer frame for the whole list.
 
* 'Start' and 'End' build an inner frame for each article item.
 
   
  +
''Startall'', ''Start'', ''End'' and ''Endall'' are wiki tags used to separate the list items.
Because wiki syntax depends on newline characters the string <tt>\n</tt> must be used to explicitly insert newline characters into the output.
 
  +
* ''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, {{code|\n}} or {{code|¶}} 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 symbols:
 
   
  +
As we want to be able to control output completely, we reference article names and other possible output by special {{dpl3|VARIABLES|%VARIABLES%}}:
* <tt>%NR%</tt> = the current article sequence number (starting from 1)
 
  +
{{anchor|VARIABLES}}
* <tt>%PAGE%</tt> = the name of the page (including namespace)
 
* <tt>%PAGEID%</tt> = the internal unique numeric ID of the arcticle page
+
* {{tt|%NR%}} = the current article sequence number (starting from 1)
  +
* {{tt|%PAGE%}} = the name of the article (including namespace)
* <tt>%IMAGE%</tt> = the physical path to an image (based on hash values, e.g. ''5/5d/myImage.jpg'')
 
  +
* {{tt|%PAGEID%}} = the internal unique numeric ID of the article page
* <tt>%PAGESEL%</tt> = the name of a page which was used within the selection criteria (only applies to <tt>[[linksfrom]]</tt> and <tt>[[linksto]]</tt>)
 
  +
* {{tt|%IMAGE%}} = the physical path to an image (based on hash values, e.g. ''5/5d/myImage.jpg'')
* <tt>%IMAGESEL%</tt> = the name of an image which was used within the selection criteria (only applies to <tt>[[imageused]]</tt>)
 
  +
* {{tt|%PAGESEL%}} = the name of a page which was used within the selection criteria (only applies to {{dpl3|linksfrom}} and {{dpl3|linksto}})
  +
* {{tt|%IMAGESEL%}} = the name of an image which was used within the selection criteria (only applies to {{dpl3|imageused}})
 
----
 
----
* <tt>%TITLE%</tt> = the title of the page (without the namespace)
+
* {{tt|%TITLE%}} = the title of the page (without the namespace)
* <tt>%NAMESPACE%</tt> = the namespace of the page
+
* {{tt|%NAMESPACE%}} = the namespace of the page
 
----
 
----
* <tt>%COUNT%</tt> = the usage counter (requires <tt>[[addpagecounter]]=true</tt>)
+
* {{tt|%SIZE%}} = the article size (requires {{dpl3|addpagesize|=true}})
* <tt>%SIZE%</tt> = the article size (requires <tt>[[addpagesize]]=true</tt>)
+
* {{tt|%SIZEFS%}} = a font size number which is based on the article size (logarithm of square root of counter)
  +
* {{tt|%COUNT%}} = the usage counter (requires {{dpl3|addpagecounter|=true}}) {{red|Removed in MediaWiki 1.25}}<ref name=hitcounters/>
* <tt>%SIZEFS%</tt> = a font size number which is based on the article size (logarithm of square root of counter)
 
* <tt>%COUNTFS%</tt> = a font size number which is based on the usage counter (currently this is the logarithm of the usage counter)
+
* {{tt|%COUNTFS%}} = a font size number which is based on the usage counter (currently this is the logarithm of the usage counter) {{red|Removed in MediaWiki 1.25}}<ref name=hitcounters/>
* <tt>%COUNTFS2%</tt> = similar to <tt>%COUNTFS%</tt>, but based on the logarithm of the square root of the usage counter.
+
* {{tt|%COUNTFS2%}} = similar to {{tt|%COUNTFS%}}, but based on the logarithm of the square root of the usage counter {{red|Removed in MediaWiki 1.25}} <ref name=hitcounters/>
* <tt>%EDITSUMMARY%</tt> = the change log message of a revision; only accessible if the DPL query is based on revisions.
 
 
----
 
----
* <tt>%DATE%</tt> = the date selected, eg. <tt>lastedit</tt>; requires <tt>[[addeditdate]]=true</tt> or similar; the formatting of the date can be influenced using <tt>[[#userdateformat|userdateformat=]]</tt>
+
* {{tt|%DATE%}} = the date selected, eg. {{tt|lastedit}}; requires {{dpl3|addeditdate|=true}} or similar; the formatting of the date can be influenced using {{dpl3|userdateformat|=}}
* <tt>%USER%</tt> = the user who changed the document last; requires <tt>[[adduser]]=true</tt>
+
* {{tt|%USER%}} = the user who changed the document last; requires {{dpl3|adduser|=true}}
 
----
 
----
* <tt>%CONTRIBUTOR%</tt> = the user who made a contribution; requires <tt>[[addcontribution]]=true</tt>
+
* {{tt|%CONTRIBUTOR%}} = the user who made a contribution; requires {{dpl3|addcontribution|=true}}
* <tt>%CONTRIBUTION%</tt> = the number of bytes changed; requires <tt>[[addcontribution]]=true</tt>
+
* {{tt|%CONTRIBUTION%}} = the number of bytes changed; requires {{dpl3|addcontribution|=true}}
* <tt>%CONTRIB%</tt> = an asterisk bar to indicate the amount of change; requires <tt>[[addcontribution]]=true</tt>
+
* {{tt|%CONTRIB%}} = an asterisk bar to indicate the amount of change; requires {{dpl3|addcontribution|=true}}
 
----
 
----
* <tt>%CATLIST%</tt> = a pipe-separated list of links to all categories to which the article belongs (requires <tt>[[addcategories]]=true</tt>)
+
* {{tt|%CATLIST%}} = a pipe-separated list of links to all categories to which the article belongs (requires {{dpl3|addcategories|=true}})
* <tt>%CATBULLETS%</tt> = a bullet point list of links to all categories to which the article belongs (requires <tt>[[addcategories]]=true</tt>)
+
* {{tt|%CATBULLETS%}} = a bullet point list of links to all categories to which the article belongs (requires {{dpl3|addcategories|=true}})
* <tt>%CATNAMES%</tt> = a comma-separated list of all categories to which the article belongs (requires <tt>[[addcategories]]=true</tt>)
+
* {{tt|%CATNAMES%}} = a comma-separated list of all categories to which the article belongs (requires {{dpl3|addcategories|=true}})
 
----
 
----
* <tt>%REVISION%</tt> = the name of the revision of the article; this will only be available if you made a selection based on revisions
+
* {{tt|%REVISION%}} = the name of the revision of the article; only accessible if the DPL query is based on {{dpl3|REVISION|revisions}}
  +
* {{tt|%EDITSUMMARY%}} = the change log message of a revision; only accessible if the DPL query is based on {{dpl3|REVISION|revisions}}
 
----
 
----
* <tt>%EXTERNALLINK%</tt> = the external hyperlink found as a consequence of the [[linkstoexternal]] statement
+
* {{tt|%EXTERNALLINK%}} = the external hyperlink found as a consequence of the {{dpl3|linkstoexternal}} statement
 
----
 
----
   
These symbols will be replaced by the corresponding values if they occur within 'Start' or 'End' or within the corresponding tags of the <tt>[[#secseparators|secseparators]]=</tt> parameter.
+
These variables will be replaced by the corresponding values if they occur within ''Start'' or ''End'' or within the corresponding tags of the {{dpl3|secseparators|=}} parameter.
   
 
----
 
----
   
In addition there are some symbolic variables which can ONLY be used in <tt>[[resultsheader]]</tt> and <tt>[[resultsfooter]]</tt>:
+
In addition there are some symbolic variables which can ONLY be used in {{dpl3|resultsheader}} and {{dpl3|resultsfooter}}:
* <tt>%PAGES%</tt> = number of articles in the result set
+
* {{tt|%PAGES%}} = number of articles in the result set
* <tt>%TOTALPAGES%</tt> = total number of articles in the result set, regardless of count limits; will only be calculated if used.
+
* {{tt|%TOTALPAGES%}} = total number of articles in the result set, regardless of count limits; will only be calculated if used
* <tt>%VERSION%</tt> = the current DPL version
+
* {{tt|%VERSION%}} = the current DPL version
 
----
 
----
* <tt>%DPLTIME%</tt> = 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.
+
* {{tt|%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.
 
----
 
----
* <tt>%FIRSTNAMESPACE%, %FIRSTTITLE%, %LASTNAMESPACE%, %LASTTITLE%</tt> : These variables contain namespace and title of the first / last article in the result set; the information is intended to be used for page scrolling
+
* {{tt|%FIRSTNAMESPACE%}}, {{tt|%FIRSTTITLE%}}, {{tt|%LASTNAMESPACE%}}, {{tt|%LASTTITLE%}} = namespace and title of the first / last article in the result set; the information is intended to be used for page scrolling
* <tt>%SCROLLDIR%</tt> : The value of this variable is set by the URL parameter <tt>DPL_scrollDir</tt>. It is passed to the scroll helper template which uses it to produce its links for scrolling.
+
* {{tt|%SCROLLDIR%}} = set by the URL parameter {{tt|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 DPL2 can also be produced with the following statements:
+
For example, the classical default output of DPL can also be produced with the following statements:
   
  +
<!-- originally, category=Africa, and there was no titlematch/nottitlematch-->
Example:
 
  +
{| style="border-spacing: 10px 0;"
<pre><nowiki>
 
  +
| align=center| default || align=center| formatted
{{#dpl:
 
  +
|- style="vertical-align:top;"
|category = Africa
 
  +
|<pre><nowiki>
|format = ,\n* [[%PAGE%|%TITLE%]],,
 
  +
<dpl>
}}
 
  +
titlematch = %Help%
  +
nottitlematch = %o%
  +
includesubpages = false
  +
</dpl>
  +
</nowiki></pre>
  +
|<pre><nowiki>
  +
<dpl>
  +
titlematch = %Help%
  +
nottitlematch = %o%
  +
includesubpages = false
  +
format = ,\n* [[%PAGE%]],,
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
  +
|-
 
  +
|<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 "*" by 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.
 
  +
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 {{code|*}} at the ''beginning of a line'' &mdash; therefore we have to use a special symbol {{code|\n}} or {{code|¶}} to refer to the beginning of a new line of wiki text. Replace the {{code|*}} with a {{code|#}} and you will get a numbered list. {{tt|Startall}} and {{tt|Endall}} are empty (note that we start with a comma, note the two commas at the end), the {{tt|Start}} tag is used to create a new line with an initial <code>* </code> 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:
 
Creating a top-five hitlist with access rates and bold article names of varying size could be done like this:
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
  +
category = Help
|category = Africa
 
|ordermethod = counter
+
ordermethod = counter
|order = descending
+
order = descending
|addpagecounter = true
+
addpagecounter = true
|count = 5
+
count = 5
|format = ,\n%COUNT% --- <font size="%COUNTFS%">'''[[%PAGE%]]'''</font>,<br/>,
+
format = ,\n%COUNT% --- <font size="%COUNTFS%">'''[[%PAGE%]]'''</font>,<br/>,
  +
</dpl>
}}
 
  +
</nowiki></pre>
  +
However, {{dpl3|addpagecounter}}, {{dpl3|ordermethod|=counter}}, {{tt|%COUNT%}}, and {{tt|%COUNTFS%}} were removed in MediaWiki 1.25.<br/>
  +
Below is an example of how to use {{tt|%NR%}} to set the font size.
  +
<pre><nowiki>
  +
<dpl>
  +
category = Help
  +
order = descending
  +
addpagecounter = true
  +
count = 4
  +
format = ,\n<font size="%NR%">'''[[%PAGE%]]'''</font>,<br/>,
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
  +
<dpl>
  +
category = Help
  +
order = descending
  +
addpagecounter = true
  +
count = 4
  +
format = ,\n<font size="%NR%">'''[[%PAGE%]]'''</font>,<br/>,
  +
</dpl>
   
 
You can also use HTML syntax for the tags, although this is discouraged.
 
You can also use HTML syntax for the tags, although this is discouraged.
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
  +
linksto = DPL
|linksto = Africa
 
|format = <ul type="disc">,<li>[[%PAGE%]],</li>,</ul>
+
format = <ul type="disc">,<li>[[%PAGE%]],</li>,</ul>
  +
</dpl>
}}
 
 
</nowiki></pre>
 
</nowiki></pre>
  +
<dpl>
  +
linksto = DPL
  +
format = <ul type="disc">,<li>[[%PAGE%]],</li>,</ul>
  +
</dpl>
   
 
Now let us create a table using wiki syntax:
 
Now let us create a table using wiki syntax:
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
  +
linksto = DPL
|linksto = Africa
 
|format = {| class="wikitable"¶!pages found,¶|-¶|[[%PAGE%]],,¶|}
+
format = {| class="wikitable"¶!pages found,¶|-¶|[[%PAGE%]],,¶|}
  +
</dpl>
}}
 
 
</nowiki></pre>
 
</nowiki></pre>
We use 'Startall' to define the table header and 'Endall' for the footer.
+
We use {{tt|Startall}} to define the table header and {{tt|Endall}} for the footer.
 
Each article is presented in a table row using wiki syntax for table layout.
 
Each article is presented in a table row using wiki syntax for table layout.
  +
<dpl>
  +
linksto = DPL
  +
format = {| class="wikitable"¶!pages found,¶|-¶|[[%PAGE%]],,¶|}
  +
</dpl>
   
'''we could also produce image galleries:'''
+
We could also produce image galleries:
<pre>
+
<pre><nowiki>
{{#dpl:
+
<dpl>
|namespace = Image
+
namespace = File
  +
category = Hydra images|Template images
|format = «gallery»,%PAGE%\n,,«/gallery»
 
  +
count = 6
}}
 
  +
format = <gallery widths=20px heights=20px>,%PAGE%\n,,</gallery>
</pre>
 
  +
</dpl>
  +
</nowiki></pre>
  +
<dpl>
  +
namespace = File
  +
category = Hydra images|Template images
  +
count = 6
  +
format = <gallery widths=20px heights=20px>,%PAGE%\n,,</gallery>
  +
</dpl>
   
===secseparators===
+
=====secseparators=====
{{DPL Parameter
+
{{DPL parameter
 
|name = secseparators
 
|name = secseparators
|purpose= customize the output format of included sections. Can be used with standard output modes and with <tt>[[#mode|mode]]=userformat</tt>.
+
|purpose= customize the output format of included sections. Can be used with standard output modes and with {{dpl3|mode|=userformat}}.
 
}}
 
}}
   
====Syntax====
+
Syntax:
   
<code>secseparators=Start1,End1,Start2,End2,..,..</code>
+
{{DPL syntax|secseparators=''Start1'',''End1'',''Start2'',''End2'',..,..}}
   
 
or
 
or
   
<code>secseparators=Start</code>
+
{{DPL syntax|secseparators=''Start''}}
   
''Please note that the semantics of this parameter '''have changed with version 0.9.6!'''. When upgrading to 0.9.6 it will probably be necessary to change the <tt>secseparator</tt> statements.
+
''Please note that the semantics of this parameter '''have changed with version 0.9.6!'''. When upgrading to 0.9.6 it will probably be necessary to change the {{dpl3|secseparators}} statements.
   
In the first syntax variant, specify ''pairs of tags'' which correspond to the <tt>[[includepage]]</tt> statement. <tt>StartN</tt> and <tt>EndN</tt> are HTML strings or wiki tags which will be put around each transcluded section (see <tt>[[#includepage|includepage]]=name1,name2,...</tt>).
+
In the first syntax variant, specify ''pairs of tags'' which correspond to the {{dpl3|includepage}} statement. {{tt|StartN}} and {{tt|EndN}} are HTML strings or wiki tags which will be put around each transcluded section (see {{dpl3|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 (<tt>EndN</tt>) will be empty for all transcluded sections.
+
In the second syntax variant, specify just one element which will then be used as {{tt|StartN}} for all sections; in this case the second tag ({{tt|EndN}}) will be empty for all transcluded sections.
   
Symbolic replacements of <tt>%PAGE%</tt> etc. take place as described in <tt>[[#listseparators|listseparators]]</tt>. In addition, the symbol <tt>%SECTION%</tt> can be used to refer to the section found (works only for chapter headings).
+
Symbolic replacements of {{tt|%PAGE%}} etc. take place as described in {{dpl3|listseparators}}. In addition, the variable {{tt|%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 <tt>secseparator</tt> tags will only be put once around the whole block (but see <tt>[[#dominantsection|dominantsection]]</tt>).
+
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 {{dpl3|secseparators}} tags will only be put once around the whole block (but see {{dpl3|dominantsection}}).
 
====Example====
 
   
  +
======Example======
  +
<!-- originally, linksto=Africa, includepage=#fruit,#color, with "fruit" & "color" column headers -->
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
|linksto = Africa
+
titlematch = DPL3/d%
|mode = userformat
+
ignorecase = true
  +
linksto = Extension:DPL3/Manual
|listseparators = {¦¶!pages found¶!fruit¶!color,¶¦-¶¦[[%PAGE%]],,¶¦}
 
  +
listseparators = {|class="dpl secsep"¶!Pages found¶!Syntax¶!Example,¶|-¶|[[%PAGE%|%TITLE%]],,¶|}
|includepage = #fruit,#color
 
  +
includepage = #Syntax,##Example.*
|secseparators = ¶¦,,¶¦,,
 
  +
secseparators = ¶|,,¶|,,
}}
 
  +
count = 2
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
  +
<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 {{dpl3|listseparators}} to define a table with three columns and put a link to the article in the first column of each row. Use {{dpl3|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 {{code|¶}} symbols ({{code|\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 {{dpl3|secseparators}} statement in order to apply this as a start tag to all transcluded sections; so it could have also been written:
Which produces,
 
{{#dpl:
 
|linksto = Africa
 
|mode = userformat
 
|listseparators = {¦¶!pages found¶!fruit¶!color,¶¦-¶¦[[%PAGE%]],,¶¦}
 
|includepage = #fruit,#color
 
|secseparators = ¶¦,,¶¦,,
 
}}
 
   
  +
======Example 2======
Use <tt>[[#listseparators|listseparators]]</tt> to define a table with three columns and put a link to the article in the first column of each row. Use <tt>secseparators</tt> 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 "fruit", it will result in an empty cell in the table.
 
  +
<!-- originally, linksto=Africa, includepage=#fruit[50],#color[100 more..], with matching column headers -->
 
As mentioned above, a single element can be used in the <tt>secseparators</tt> statement in order to apply this as a start tag to all transcluded sections; so it could have also been written:
 
 
====Example 2====
 
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
|linksto = Africa
+
titlematch = DPL3/d%
|mode = userformat
+
ignorecase = true
  +
linksto = Extension:DPL3/Manual
|listseparators = {|\n!pages found\n!fruit\n!color,\n|-\n|[[%PAGE%]],,\n|}
 
  +
listseparators = {|class="dpl secsep"\n!Pages found\n!Syntax\n!Example,\n|-\n|[[%PAGE%|%TITLE%]],,\n|}
|includepage = #fruit[50],#color[100 more..]
 
  +
includepage = #Syntax[84],##Example.*[180 more..]
|secseparators = \n|
 
  +
secseparators = \n|
}}
 
  +
count = 3
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
  +
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 {{code|[ ]}}can break text formatted with wikitext or tags such as {{tag|nowiki|o}}.
  +
<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>
   
  +
=====multisecseparators=====
Assuming that the chapters on ''fruit'' and ''color'' contain long texts, they can be truncated to 50 or 100 characters. A link which refers directly to those chapters will be generated automatically if needed.
 
   
  +
{{DPL parameter
===multisecseparators===
 
 
{{DPL Parameter
 
 
|name = multisecseparators
 
|name = multisecseparators
 
|purpose= put a tag between multiple transcluded parts which refer to the same template or chapter.
 
|purpose= put a tag between multiple transcluded parts which refer to the same template or chapter.
Line 379: Line 503:
 
Syntax:
 
Syntax:
   
<code>multisecseparators=sep1,sep2,...</code>
+
{{DPL syntax|multisecseparators=''sep1'',''sep2'',...}}
   
The tags correspond to the transcluded section (see <tt>[[#includepage|includepage]]=name1,name2,...</tt>).
+
The tags correspond to the transcluded section (see {{dpl3|includepage|=name1,name2,...}}).
   
Symbolic replacements of <tt>%PAGE%</tt> etc. take place as described in <tt>[[#listseparators|listseparators]]</tt>. In addition the symbol <tt>%SECTION%</tt> 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.
+
Symbolic replacements of {{tt|%PAGE%}} etc. take place as described in {{dpl3|listseparators}}. In addition, the variable {{tt|%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.
+
If an article uses the same template more than once you will get all references with {{tt|sepN}} as a separator.
   
Example:
+
Example:<!--
  +
<pre><nowiki><- ---original dpl example, changed below to present a working example--- ->
  +
<dpl>
  +
category=TestSSt
  +
includepage={interfaces_overview} dpl
  +
mode=userformat
  +
listseparators=¶{|class=sortable ¶!Interface ¶!Source system ¶!Target system ¶!Technology,¶|-¶|[[%PAGE%]] ¶,¶,¶|}
  +
secseparators = \n|
  +
multisecseparators=¶|-¶|&amp;nbsp;|
  +
</dpl>
  +
</nowiki></pre>-->
  +
{| class="dpl multisec"
  +
|- class="dpl pre"
  +
|colspan=2|<pre><nowiki>
  +
<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>
  +
</nowiki></pre>
  +
|-
  +
|colspan=2|
  +
{|
  +
|<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>
  +
|}
  +
|-
  +
|colspan=2|Values cannot be formatted within {{dpl3|include}}, as formatting can only occur in formatting statements (in these examples {{dpl3|listseparators}}, {{dpl3|secseparators}}, and {{dpl3|multisecseparators}}). {{tt|%VARIABLES%}} can be omitted from the {{dpl3|include}}, and instead be placed in these formatting statements, for further formatting.<br/>
  +
We can achieve some field formatting by changing some of the above dpl statements:
  +
|- class="dpl cols2 pre"
  +
|
  +
include = {dpl manual}:{{code|%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 = ¶|{{code|<nowiki>[[%PAGE%|{{#explode:,|:|1}}]]</nowiki>|class="dpl light-background"}},¶|class="dpl dark-background"|,
  +
|
  +
include = {dpl manual}:{{code||class="dpl light-background"}},{dpl parameter}:name:purpose[50]
  +
listseparators = ¶{|class="wikitable sortable" ¶!colspan=3|%VARIABLES%... listseparators¶|-¶!Page ¶!Name ¶!Purpose,¶|-{{code|<nowiki>¶|[[%PAGE%|{{#explode:%TITLE%|:|1}}]]</nowiki>|class="dpl light-background"}},¶|-¶|class="dpl blue-background" colspan=3|¶|-,¶|}
  +
secseparators = {{code||class="dpl light-background"}},,¶|class="dpl dark-background"|,{{code|<nowiki>,¶|,</nowiki>|class="dpl light-background"}}
  +
|- class="dpl cols2"
  +
|<dpl>
  +
titlematch = DPL%
  +
nottitlematch = %volume%|%page selection%
  +
uses = Template:DPL Parameter
  +
include = {dpl manual}:%TITLE%,{dpl parameter}:name:purpose[50]
  +
mode = userformat
  +
listseparators = ¶{|class="wikitable sortable" ¶!colspan=3|These fields are formatted within secseparators¶|-¶!Page ¶!Name ¶!Purpose,¶|-,¶|-¶|class="dpl blue-background" colspan=3|¶|-,¶|}
  +
secseparators = ¶|[[%PAGE%|{{#explode:,|:|1}}]],¶|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}:name:purpose[50]
  +
mode = userformat
  +
listseparators = ¶{|class="wikitable sortable" ¶!colspan=3|%TITLE% is added and formatted within listseparators¶|-¶!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>
  +
|-
  +
|colspan=2|Formatting handled by a phantom template (eg. [[Template:DPL_parameter_dpl]]) will apply to both {{dpl3|secseparators}} and {{dpl3|multisecseparators}}.<br/>If separate formatting is required, it needs to be assigned to their respective parameters (as shown below).
  +
|-
  +
|colspan=2|To prevent truncated words, see [[Template:DPL_parameter_dpl.nowordbreak]] (which uses [[Template:nowordbreak]]).
  +
|-
  +
|colspan=2|<pre><nowiki>
  +
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"|
  +
</nowiki></pre>
  +
|- class="dpl cols2"
  +
|<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 [[Extension:DPL3/Manual|title page]] of this manual, whose dpl is as follows:
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
  +
nottitlematch=%volume%|%page selection%
|category=TestSSt
 
  +
namespace = Help
|includepage={interfaces_overview} dpl
 
  +
uses = Template:DPL parameter
|mode=userformat
 
  +
mode = userformat
|listseparators=¶{|class=sortable ¶!Interface ¶!Source system ¶!Target system ¶!Technology,¶|-¶|[[%PAGE%]] ¶,¶,¶|}
 
  +
replaceintitle = @DPL Manual/@,
|secseparators = \n|
 
  +
include = {DPL Manual}:[[%PAGE%|%TITLE%]],{DPL parameter}/dpl
|multisecseparators=¶|-¶|&amp;nbsp;|
 
  +
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>
 
</nowiki></pre>
 
</nowiki></pre>
  +
<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>
   
See also [[Test article structure]].
+
See also {{dpl3|Test article structure}}.
   
===dominantsection===
+
=====dominantsection=====
   
{{DPL Parameter
+
{{DPL parameter
 
|name = dominantsection
 
|name = dominantsection
 
|purpose= 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.
 
|purpose= 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.
Line 410: Line 660:
 
Syntax:
 
Syntax:
   
<code>dominantsection=number</code> between 1 and the number of arguments in your <tt>includepage=</tt> statement
+
{{DPL syntax|dominantsection=''number''}} between 1 and the number of arguments in your {{dpl3|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.
 
If there is only 0 or 1 piece of contents for the dominant section you will see no difference from normal DPL behaviour.
Line 419: Line 669:
   
 
Note:
 
Note:
Using <tt>dominantsection</tt> together with <tt>[[#table|table]]</tt> may lead to strange result formatting.
+
Using {{dpl3|dominantsection}} together with {{dpl3|table}} may lead to strange result formatting.
   
 
== Generating tabular output ==
 
== Generating tabular output ==
Line 425: Line 675:
 
===table===
 
===table===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = table
 
|name = table
|purpose= a simple syntax to create standard tabular output; see also [[tablerow]]
+
|purpose= a simple syntax to create standard tabular output; see also {{dpl3|tablerow}}
 
}}
 
}}
   
 
Syntax:
 
Syntax:
   
<code>table=</code> ''tableatr'', ''linkheader'', (column headlines) ..
+
{{DPL syntax|table=''tableatr'', ''linkheader'', (column headlines) ..}}
   
The <tt>table</tt> statement is a shortcut which implicitly sets certain values for other DPL parameters, namely <tt>[[mode]]</tt>, <tt>[[listseparators]]</tt> / <tt>[[#Format|format]]</tt>, <tt>[[secseparators]]</tt>, and <tt>[[multisecseparators]]</tt>.
+
The {{dpl3|table}} statement is a shortcut which implicitly sets certain values for other DPL parameters, namely {{dpl3|mode}}, {{dpl3|listseparators}} / {{dpl3|format}}, {{dpl3|secseparators}}, and {{dpl3|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]].
+
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 {{dpl3|tablerow}}.
   
If you use <tt>table</tt> 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 <tt>format</tt> in combination with <tt>table</tt>. Therefore this parameter is NOT overwritten by the <tt>table</tt> 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:
+
If you use {{dpl3|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 {{dpl3|format}} in combination with {{dpl3|table}}. Therefore this parameter is NOT overwritten by the {{dpl3|table}} command. The third argument can be used to output meta data like {{tt|%COUNT%}}, {{tt|%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
 
include = {some template}:parm1,#some heading
 
table =,,tplparm,chapter,#hits
 
table =,,tplparm,chapter,#hits
 
format =,,\n%COUNT%
 
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 <tt>[[#Format|format]]</tt> statement.
+
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 {{dpl3|format}} statement.
   
The use of <tt>table</tt> requires an <tt>[[include]]</tt> statement which should, for reasons of readability, directly precede the <tt>table</tt> statement). Each argument of the <tt>include</tt> statement will produce one or more columns in the output table described in the <tt>table</tt> statement.
+
The use of {{dpl3|table}} requires an {{dpl3|include}} statement which should, for reasons of readability, directly precede the {{dpl3|table}} statement). Each argument of the {{dpl3|include}} statement will produce one or more columns in the output table described in the {{dpl3|table}} statement.
   
'''<tt>table</tt> expects a comma-separated list of parameters''':
+
'''{{dpl3|table}} expects a comma-separated list of parameters''':
   
 
* The first parameter will be used to describe general parameters for the table
 
* 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 <tt>class=wikitable</tt> or <tt>class=mytable</tt> if ''mytable'' is defined in the [[Mediawiki:Common.css]] document.
+
** it is recommended to make a CSS reference here, using something like {{tt|<nowiki>class=wikitable</nowiki>}} or {{tt|<nowiki>class=mytable</nowiki>}} if ''mytable'' is defined in the [[Mediawiki:Common.css]] document.
** <tt>class=wikitable</tt> is the '''default value'''. Use double-quotes to specify multiple classes, e.g., <tt>class="wikitable sortable"</tt>.
+
** {{tt|<nowiki>class=wikitable</nowiki>}} is the '''default value'''. Use double-quotes to specify multiple classes, e.g., {{tt|<nowiki>class="wikitable sortable"</nowiki>}}.
   
 
* The '''second parameter''' is the headline for the first column.
 
* 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.
 
** The first column will automatically contain a reference to the article, so something like ''Article'' should be o.k.
** <tt>Article</tt> is the '''default value'''.
+
** {{tt|Article}} is the '''default value'''.
** if you use a single <tt>-</tt> (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 <tt><nowiki>[[{{{%PAGE%}}}|{{{%TITLE%}}}]]</nowiki></tt> within a phantom template.
+
** if you use a single {{tt|-}} (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 {{tt|<nowiki>[[{{{%PAGE%}}}|{{{%TITLE%}}}]]</nowiki>}} within a phantom template.
  +
  +
* All subsequent parameters are column headings which correspond to the arguments of the {{dpl3|include}} parameter. Note that if you call a ''phantom template'' (like {{tt|{Some Template}.dpl}}) in the include statement, you will have to provide as many headlines as the ''phantom template'' produces columns.
   
  +
* {{dpl3|mode}} will be set to ''userformat''
* All subsequent parameters are column headings which correspond to the arguments of the <tt>include</tt> parameter. Note that if you call a ''phantom template'' (like <tt>{Some Template}.dpl</tt>) in the include statement, you will have to provide as many headlines as the ''phantom template'' produces columns.
 
   
  +
* {{dpl3|listseparators}} will be configured to produce wiki syntax which defines a table
* <tt>mode</tt> will be set to ''userformat''
 
   
* <tt>listseparators</tt> will be configured to produce wiki syntax which defines a table
+
* {{dpl3|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.
   
* <tt>secseparators</tt> 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.
+
* {{dpl3|multisecseparators}} will be configured to produce wiki syntax which creates another table row for multiple occurrences of the ''first'' {{dpl3|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 {{tt|{{!}}}} has already been put into the output stream). So start directly with the contents of the first column. To add more columns use a {{tt|{{!}}}} in a separate line. Example:
* <tt>multisecseparators</tt> will be configured to produce wiki syntax which creates another table row for multiple occurencies of the ''first'' <tt>include</tt> 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 <tt>|</tt> has already been put into the output stream). So start directly with the contents of the first column. To add more columns use a <tt>|</tt> in a separate line. Example:
 
 
 
<pre><nowiki>
 
<pre><nowiki>
 
some output for the first column: {{{1|}}}
 
some output for the first column: {{{1|}}}
Line 477: Line 727:
 
</nowiki></pre>
 
</nowiki></pre>
   
It may sound complicated, but is a ''huge'' improvement compared to the native use of <tt>mode, listseparators, secseparators</tt> and <tt>multisecseparators</tt>.
+
It may sound complicated, but is a ''huge'' improvement compared to the native use of {{dpl3|mode}}, {{dpl3|listseparators}}, {{dpl3|secseparators}} and {{dpl3|multisecseparators}}.
   
A typical DPL statement using the <tt>table</tt> parameter would contain:
+
A typical DPL statement using the {{dpl3|table}} parameter would contain:
 
include = #Chapter X,{T1}:parm1,#Chapter Y,{T2}.dpl
 
include = #Chapter X,{T1}:parm1,#Chapter Y,{T2}.dpl
 
table = class=sortable, Article, X , t-p , Y , T2-a, T2-b
 
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 <tt>include</tt> and <tt>table</tt>. 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 <tt>include</tt>. Note that there are TWO headlines which correspond to the last argument of the <tt>include</tt> 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'').
+
Note that we have written the above statement in a way to show the correspondence between {{dpl3|include}} and {{dpl3|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 {{dpl3|include}}. Note that there are TWO headlines which correspond to the last argument of the {{dpl3|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'').
   
Now look at the [[Test table|examples]]
+
Now look at the {{dpl3|Test table|examples}}
   
 
===tablerow===
 
===tablerow===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = tablerow
 
|name = tablerow
|purpose= a simple syntax to create customized tabular output; see also [[table]]
+
|purpose= a simple syntax to create customized tabular output; see also {{dpl3|table}}
 
}}
 
}}
   
 
Syntax:
 
Syntax:
   
<code>tablerow=</code> ''coldef'', ..
+
{{DPL syntax|tablerow=''coldef'', ..}}
   
Where ''coldef'' contains wiki code which uses the symbol '%%' to refer to the corresponding element of an <tt>[[include]]</tt> statement.
+
Where ''coldef'' contains wiki code which uses the symbol '%%' to refer to the corresponding element of an {{dpl3|include}} statement.
   
The <tt>table</tt> statement (which '''must''' be used as a prerequisite for <tt>tablerow</tt>) 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" to make sure that the field contents is displayed correctly if it contains wiki syntax that depends on linebreaks (e.g. enumeration list).
+
The {{dpl3|table}} statement (which '''must''' be used as a prerequisite for {{dpl3|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 {{code|\n}} or {{code|¶}} 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 <tt>tablerow</tt> statement as there are columns in your table. Skipping a column would suppress output for that column completely.
+
You must specify all columns. i.e. you must have as many entries in the {{dpl3|tablerow}} statement as there are columns in your table. Skipping a column would suppress output for that column completely.
  +
 
The <tt>tablerow</tt> command is best explained by an example (you can also find this example on the title page of this wiki):
+
The {{dpl3|tablerow}} command is best explained by an example:
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
|category=African Union member states
+
category=Help
  +
titlematch=DPL%
|nottitlematch=Sudan
 
  +
count=4
|addpagecounter=true
 
|includepage ={Infobox Country or territory}:area:population_estimate,%0[100]
+
includepage ={DPL Manual}:section,%-1[25]
  +
table =,Title,Sub Title,Last Section (25 chars)
|format =,,\n|align=right|²{#ifexpr:%COUNT%>300¦<big>'''%COUNT%'''</big>¦%COUNT%}²,
 
  +
tablerow =style="text-align:center;background-color:lightyellow;"|%%,|%%,
|table =,Country,Area,Population,Text,#hits
 
  +
</dpl>
|tablerow =align=right|%%,align=right|%%,bgcolor=lightyellow|<small>%%</small>,\n|align=right|%%
 
  +
</nowiki></pre>
}}
 
  +
<dpl>
  +
category=Help
  +
titlematch=DPL%
  +
count=4
  +
includepage ={DPL Manual}:section,%-1[25]
  +
table =,Title,Sub Title,Last Section (25 chars)
  +
tablerow =style="text-align:center;background-color:lightyellow;"|%%,|%%,
  +
</dpl>
  +
The following example includes the use of {{dpl3|addpagecounter}} and {{tt|%COUNT%}}, both of which were removed in MediaWiki 1.25.
  +
<pre><nowiki>
  +
<dpl>
  +
category=African Union member states
  +
nottitlematch=Sudan
  +
addpagecounter=true
  +
includepage ={Infobox Country or territory}:area:population_estimate,%0[100]
  +
format =,,\n|style="text-align:right;"|²{#ifexpr:%COUNT%>300¦<big>'''%COUNT%'''</big>¦%COUNT%}²,
  +
table =,Country,Area,Population,Text,#hits
  +
tablerow =style="text-align:right;"|%%,style="text-align:right;"|%%,style="background-color:lightyellow;"|<small>%%</small>,\n|style="text-align:right;"|%%
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
 
* We select some African countries, we exclude Sudan
 
* We select some African countries, we exclude Sudan
 
* We acquire a piece of meta data about the articles we will find (in our case the usage counter)
 
* We acquire a piece of meta data about the articles we will find (in our case the usage counter)
* We include two named parameters from a template call, {{tl|Infobox Country or territory}}
+
* We include two named parameters from a template call, <nowiki>{{Infobox Country or territory}}</nowiki>
 
* We include a short text passage from the text before the first chapter
 
* We include a short text passage from the text before the first chapter
* We use the third parameter of <tt>format</tt> to output the usage counter (we could even highlight values above 100 here, for example)
+
* We use the third parameter of {{dpl3|format}} to output the usage counter (we could even highlight values above 100 here, for example)
 
* We highlight usage values above 300
 
* We highlight usage values above 300
 
* We define a standard wiki table with the article name in the first column (named "Country")
 
* We define a standard wiki table with the article name in the first column (named "Country")
Line 527: Line 796:
 
===tablesortcol===
 
===tablesortcol===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = tablesortcol
 
|name = tablesortcol
|purpose= define a column to be used as sort key (see also [[table]] )
+
|purpose= define a column to be used as sort key (see also {{dpl3|table}} )
 
}}
 
}}
   
 
Syntax:
 
Syntax:
   
<code>tablesortcol=</code> ''number''
+
{{DPL syntax|tablesortcol=''number''}}
   
 
''number'' is the position of the column that shall be used as sortkey when the result is initially displayed.
 
''number'' is the position of the column that shall be used as sortkey when the result is initially displayed.
Line 542: Line 811:
 
* 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.
 
* 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.
 
* 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 ..
+
* you can of course use something like 'class=sortable' together with {{dpl3|tablesortcol}}. The difference is that ..
 
** interactive sorting only works after the article has been initially displayed
 
** 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)
 
** interactive sorting tries to guess the content type of a column and sorts according to that (date, number, string)
* If you do not use <tt>tablesortcol</tt> 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 <tt>[[ordermethod]]</tt>. 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.
+
* If you do not use {{dpl3|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 {{dpl3|ordermethod}}. The default is "alphabetically by title". So, without {{dpl3|tablesortcol}} you get the tablerows in alphabetical sequence of the article names where they come from. With {{dpl3|tablesortcol}} you can order them by the column contents itself.
   
 
== Heading mode ==
 
== Heading mode ==
Line 551: Line 820:
 
===headingmode===
 
===headingmode===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = headingmode
 
|name = headingmode
|purpose= To control the output of the headings in a DPL with complex/multi-parameter [[DPL:Parameters: Controlling output order#ordermethod|ordermethods]]. (No effect with single-param ordermethods.) For <code>ordermethod=<i>method1,method2,...</i></code>, <i>method1</i> is used for headings. E.g. <code>headingmode</code> affects category headings in <code>ordermethod=category,title</code> (2-param ordermethod). See also [[#headingcount|headingcount]]
+
|purpose= To control the output of the headings in a DPL with complex/multi-parameter {{dpl3|ordermethod}}. (No effect with single-param ordermethods.) For {{dpl3|ordermethod|=''method1,method2,...''}}, ''method1'' is used for headings. E.g. {{dpl3|headingmode}} affects category headings in {{dpl3|ordermethod|=category,title}} (2-param ordermethod). See also {{dpl3|headingcount}}
 
}}
 
}}
   
 
Syntax:
 
Syntax:
   
<code>headingmode=<i>modename</i></code>
+
{{DPL syntax|headingmode=''modename''}}
   
 
''modename'' can be one of:
 
''modename'' can be one of:
 
* ''none'' &mdash; headings are not displayed, no heading &mdash; '''(default)'''
 
* ''none'' &mdash; headings are not displayed, no heading &mdash; '''(default)'''
* ''unordered'' &mdash; outputs an unordered list &mdash; HTML tag "ul"
+
* ''unordered'' &mdash; outputs an unordered list &mdash; HTML tag {{tt|ul}}
* ''ordered'' &mdash; outputs an ordered list &mdash; HTML tag "ol"
+
* ''ordered'' &mdash; outputs an ordered list &mdash; HTML tag {{tt|ol}}
* ''definition'' &mdash; outputs a definition list &mdash; HTML tag "dl"
+
* ''definition'' &mdash; outputs a definition list &mdash; HTML tag {{tt|dl}}
* ''H2'' &mdash; outputs sections &mdash; HTML tags "H2"
+
* ''H2'' &mdash; outputs sections &mdash; HTML tags {{tt|H2}} {{red|Currently broken}}
* ''H3'' &mdash; outputs sections &mdash; HTML tags "H3"
+
* ''H3'' &mdash; outputs sections &mdash; HTML tags {{tt|H3}} {{red|Currently broken}}
* ''H4'' &mdash; outputs sections &mdash; HTML tags "H4"
+
* ''H4'' &mdash; outputs sections &mdash; HTML tags {{tt|H4}} {{red|Currently broken}}
   
 
Example:
 
Example:
  +
<!-- originally, category=Africa|Europe -->
 
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
|category=Africa|Europe
+
category=Terraria Wiki|Community
  +
notcategory=Games
|ordermethod=category,title
 
  +
nottitlematch=%d%|Disambiguations
|headingmode=definition
 
  +
count=7
|mode=ordered
 
  +
ordermethod=category,title
}}
 
  +
headingmode=definition
  +
mode=ordered
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
  +
This list will output pages that belong to one of the categories Terraria Wiki, Community in a list similar to this (HTML source). The categories are listed in sorted order, and the titles are replaced with the appropriate links ({{dpl3|nottitlematch}} and {{dpl3|count}} are simply used to reduce the output size):
 
  +
{|
This list will output pages that belong to one of the categories Africa, Europe in a list similar to this (HTML source), with pages 1 and 2 in the Africa category, Page 1 in the Europe category as well (in fact, the titles are replaced with the appropriate links):
 
  +
! '''(HTML) Output''' !! '''Actual Output'''
<pre><nowiki>
 
  +
|- style="vertical-align:top;"
  +
|<pre><nowiki>
 
<dl>
 
<dl>
<dt>Africa</dt>
+
<dt>Category</dt>
 
<dd>
 
<dd>
 
<ol>
 
<ol>
 
<li>Page1</li>
 
<li>Page1</li>
 
<li>Page2</li>
 
<li>Page2</li>
</ol>
 
</dd>
 
<dt>Europe</dt>
 
<dd>
 
<ol>
 
<li>Page1</li>
 
 
</ol>
 
</ol>
 
</dd>
 
</dd>
 
</dl>
 
</dl>
 
</nowiki></pre>
 
</nowiki></pre>
  +
|
  +
<dpl>
  +
category=Terraria Wiki|Community
  +
notcategory=Games
  +
nottitlematch=%d%|Disambiguations
  +
count=7
  +
ordermethod=category,title
  +
headingmode=definition
  +
mode=ordered
  +
</dpl>
  +
|}
   
 
Headingmode can be used with multi-column output but the length of the columns may in this case vary more than you would expect.
 
Headingmode can be used with multi-column output but the length of the columns may in this case vary more than you would expect.
Line 603: Line 882:
 
===headingcount===
 
===headingcount===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = headingcount
 
|name = headingcount
|purpose= In combination with [[#headingmode|headingmode]] this parameter decides whether we show a text line with the number of articles per group or not.
+
|purpose= In combination with {{dpl3|headingmode}} this parameter decides whether we show a text line with the number of articles per group or not.
 
}}
 
}}
   
 
Syntax:
 
Syntax:
   
<code>headingcount=<i>true</i></code>
+
{{DPL syntax|headingcount=''true''}}
   
 
default is <code>headingcount=false</code>
 
default is <code>headingcount=false</code>
Line 617: Line 896:
 
=== listattr ===
 
=== listattr ===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = listattr
 
|name = listattr
|purpose= Adds attributes to HTML list elements, depending on <tt>[[#mode|mode]]</tt> (HTML element is <tt>ol</tt> for ordered, <tt>ul</tt> for unordered, <tt>div</tt> for others). Can be used with '''pseudo''' <tt>mode=inline</tt> where inline text contains one or more <tt><nowiki><BR/></nowiki></tt>.
+
|purpose= Adds attributes to HTML list elements, depending on {{dpl3|mode}} (HTML element is {{tt|ol}} for ordered, {{tt|ul}} for unordered, {{tt|div}} for others). Can be used with '''pseudo''' {{dpl3|mode|=inline}} where inline text contains one or more {{tt|<nowiki><br/></nowiki>}}.
  +
Only applicable to {{dpl3|mode|=ordered}} or {{dpl3|mode|=unordered}}.
   
Not applicable to <tt>mode=category</tt> or <tt>mode=inline</tt> (with no <tt><nowiki><BR/></nowiki></tt> in inline text).
+
Not applicable to {{dpl3|mode|=category}} or {{dpl3|mode|=inline}} (with no {{tt|<nowiki><br/></nowiki>}} in inline text).
 
}}
 
}}
   
Syntax:
+
Syntax:
  +
<code>listattr= attribute1="val1" attribute2="val2" ...</code>
 
  +
{{DPL syntax|listattr= attribute1="val1" attribute2="val2" ...}}
 
  +
 
Examples:
 
Examples:
 
{|
 
{|
 
! '''Input''' !! '''(HTML) Output''' !! '''Actual Output'''
 
! '''Input''' !! '''(HTML) Output''' !! '''Actual Output'''
  +
|- style="vertical-align:top;"
|-
 
|<pre><nowiki>
+
|width=30%|<pre><nowiki>
{{#dpl:
+
<dpl>
|ordermethod=category,title
+
category=Community
  +
nottitlematch=%Forums%|Admin%
|headingmode=ordered
 
  +
ordermethod=category,title
|mode=none
 
  +
headingmode=definition
|listattr= class="submenul"
 
  +
mode=none
|itemattr= class="submenuli" style="font-style: italic;"
 
  +
listattr= class="submenul" class="dpl light-background"
}}
 
  +
itemattr= class="submenuli" style= "font-style: italic;"
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
 
|<pre><nowiki>
 
|<pre><nowiki>
 
<ol>
 
<ol>
<li> Cat1 (link)
+
<li class="submenul" class="dpl light-background"> Cat1 (link)
 
<div class="submenul">
 
<div class="submenul">
 
<span class="submenuli" style="font-style: italic;"> Page1_1 </span> <br/>
 
<span class="submenuli" style="font-style: italic;"> Page1_1 </span> <br/>
Line 648: Line 931:
 
</div>
 
</div>
 
</li>
 
</li>
<li> Cat2 (link)
+
<li class="submenul" class="dpl light-background"> Cat2 (link)
 
<div class="submenul">
 
<div class="submenul">
 
<span class="submenuli" style="font-style: italic;"> Page2_1 </span> <br/>
 
<span class="submenuli" style="font-style: italic;"> Page2_1 </span> <br/>
Line 657: Line 940:
 
</nowiki></pre>
 
</nowiki></pre>
 
|
 
|
<ol>
+
<dpl>
  +
category=Community
<li> Cat1 (link)
 
  +
nottitlematch=%Forums%|Admin%
<div class="submenul">
 
  +
ordermethod=category,title
<span class="submenuli" style="font-style: italic;"> Page1_1 </span> <br/>
 
  +
headingmode=definition
<span class="submenuli" style="font-style: italic;"> Page1_2 </span>
 
  +
mode=none
</div>
 
  +
listattr= class="submenul" class="dpl light-background"
</li>
 
  +
itemattr= class="submenuli" style="font-style: italic;"
<li> Cat2 (link)
 
  +
</dpl>
<div class="submenul">
 
  +
|- style="vertical-align:top;"
<span class="submenuli" style="font-style: italic;"> Page2_1 </span> <br/>
 
<span class="submenuli" style="font-style: italic;"> Page2_2 </span>
 
</div>
 
</li>
 
</ol>
 
|-
 
 
|<pre><nowiki>
 
|<pre><nowiki>
{{#dpl:
+
<dpl>
|ordermethod=category,title
+
category=Community
  +
nottitlematch=%Forums%|Admin%
|headingmode=ordered
 
  +
ordermethod=category,title
|mode=unordered
 
  +
headingmode=definition
|listattr= class="submenul"
 
  +
mode=unordered
|itemattr= class="submenuli" style="font-weight: bold;"
 
  +
listattr= class="submenul" class="dpl light-background"
}}
 
  +
itemattr= class="submenuli" style= "font-style: italic;"
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
 
|<pre><nowiki>
 
|<pre><nowiki>
 
<ol>
 
<ol>
 
<li> Cat1 (link)
 
<li> Cat1 (link)
<ul class="submenul">
+
<ul class="submenul" class="dpl light-background">
<li class="submenuli" style="font-weight: bold;"> Page1_1 </li>
+
<li class="submenuli" style="font-style: italic;"> Page1_1 </li>
<li class="submenuli" style="font-weight: bold;"> Page1_2 </li>
+
<li class="submenuli" style="font-style: italic;"> Page1_2 </li>
 
</ul>
 
</ul>
 
</li>
 
</li>
 
<li> Cat2 (link)
 
<li> Cat2 (link)
<ul class="submenul">
+
<ul class="submenul" class="dpl light-background">
<li class="submenuli" style="font-weight: bold;"> Page2_1 </li>
+
<li class="submenuli" style="font-style: italic;"> Page2_1 </li>
<li class="submenuli" style="font-weight: bold;"> Page2_2 </li>
+
<li class="submenuli" style="font-style: italic;"> Page2_2 </li>
 
</ul>
 
</ul>
 
</li>
 
</li>
Line 698: Line 978:
 
</nowiki></pre>
 
</nowiki></pre>
 
|
 
|
<ol>
+
<dpl>
  +
category=Community
<li> Cat1 (link)
 
  +
nottitlematch=%Forums%|Admin%
<ul class="submenul">
 
  +
ordermethod=category,title
<li class="submenuli" style="font-weight: bold;"> Page1_1 </li>
 
  +
headingmode=definition
<li class="submenuli" style="font-weight: bold;"> Page1_2 </li>
 
  +
mode=unordered
</ul>
 
  +
listattr= class="submenul" class="dpl light-background"
</li>
 
  +
itemattr= class="submenuli" style="font-style: italic;"
<li> Cat2 (link)
 
  +
</dpl>
<ul class="submenul">
 
<li class="submenuli" style="font-weight: bold;"> Page2_1 </li>
 
<li class="submenuli" style="font-weight: bold;"> Page2_2 </li>
 
</ul>
 
</li>
 
</ol>
 
 
|}
 
|}
   
 
=== itemattr ===
 
=== itemattr ===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = itemattr
 
|name = itemattr
|purpose= Adds attributes to HTML list items, depending on 'mode' (element is 'li' for ordered/unordered, 'span' for others).
+
|purpose= Adds attributes to HTML list items, depending on {{dpl3|mode}} (element is {{tt|li}} for ordered/unordered, {{tt|span}} for others).
   
Not applicable to 'mode=category'.
+
Not applicable to {{dpl3|mode|=category}}.
 
}}
 
}}
   
Syntax:
+
Syntax:
  +
<code>itemattr= attribute1="val1" attribute2="val2" ...</code>
 
  +
{{DPL syntax|itemattr= attribute1="val1" attribute2="val2" ...}}
 
Example: see [[#listitemattr|listitemattr]].
 
   
 
=== hlistattr ===
 
=== hlistattr ===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = hlistattr
 
|name = hlistattr
|purpose= 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)
+
|purpose= Adds attributes to the HTML list element at the heading/top level, depending on {{dpl3|headingmode}} (HTML element would be {{tt|ol}} for ordered, {{tt|ul}} for unordered, {{tt|dl}} for definition, {{tt|div}} for others)
   
Not yet applicable to 'headingmode=none'.
+
Not yet applicable to {{dpl3|headingmode|=none}}.
 
}}
 
}}
   
Syntax:
+
Syntax:
  +
<code>hlistattr= attribute1="val1" attribute2="val2" ...</code>
 
  +
{{DPL syntax|hlistattr= attribute1="val1" attribute2="val2" ...}}
 
  +
 
Example:
 
Example:
 
{|
 
{|
 
! '''Input''' !! '''(HTML) Output''' !! '''Actual Output'''
 
! '''Input''' !! '''(HTML) Output''' !! '''Actual Output'''
|- valign=top
+
|- style="vertical-align:top;"
 
|<pre><nowiki>
 
|<pre><nowiki>
{{#dpl:
+
<dpl>
  +
category=Community
  +
nottitlematch=%Forums%|Admin%
 
ordermethod=category,pagetouched
 
ordermethod=category,pagetouched
headingmode=H2
+
headingmode=definition
 
mode=ordered
 
mode=ordered
hlistattr= class="topmenul" id="dmenu"
+
hlistattr= class="topmenul" id="dmenu" style= "font-size:17px;"
  +
</dpl>
}}
 
 
</nowiki></pre>
 
</nowiki></pre>
 
|<pre><nowiki>
 
|<pre><nowiki>
<div class="topmenul" id="dynamicmenu">
+
<div class="topmenul" id="dmenu" style="font-size:17px;">
<H2> Category 1 (link) </H2>
+
<li> Category 2 (link) </li>
<ol>
+
<ol>
<li>Page1_1</li>
+
<li>Page1_1</li>
<li>Page1_2</li>
+
<li>Page1_2</li>
</ol>
+
</ol>
<H2> Category 2 (link) </H2>
+
<li> Category 2 (link) </li>
<ol>
+
<ol>
<li>Page2_1</li>
+
<li>Page2_1</li>
</ol>
+
</ol>
 
</div>
 
</div>
 
</nowiki></pre>
 
</nowiki></pre>
 
|
 
|
  +
<dpl>
<div class="topmenul" id="dynamicmenu">
 
  +
category=Community
 
  +
nottitlematch=%Forums%|Admin%
<H2> Category 1 (link) </H2>
 
  +
ordermethod=category,pagetouched
<ol>
 
  +
headingmode=definition
<li>Page1_1</li>
 
  +
mode=ordered
<li>Page1_2</li>
 
  +
hlistattr= class="topmenul" id="dmenu" style="font-size:17px;"
</ol>
 
  +
</dpl>
<H2> Category 2 (link) </H2>
 
  +
|}
<ol>
 
  +
These examples compare {{dpl3|listattr}}, {{dpl3|itemattr}}, and {{dpl3|hlistattr}}
<li>Page2_1</li>
 
  +
{|
</ol>
 
  +
! '''Input''' !! '''Actual Output'''
</div>
 
  +
|- style="vertical-align:top;"
  +
|<pre><nowiki>
  +
<dpl>
  +
category=Community
  +
nottitlematch=%Forums%|Admin%
  +
ordermethod=category,title
  +
headingmode=definition
  +
mode=unordered
  +
listattr= class="submenul" class="dpl light-background"
  +
itemattr= class="submenuli" style= "font-style: italic;"
  +
</dpl>
  +
</nowiki></pre>
  +
|
  +
<dpl>
  +
category=Community
  +
nottitlematch=%Forums%|Admin%
  +
ordermethod=category,title
  +
headingmode=definition
  +
mode=unordered
  +
listattr= class="submenul" class="dpl light-background"
  +
itemattr= class="submenuli" style="font-style: italic;"
  +
</dpl>
  +
|- style="vertical-align:top;"
  +
|<pre><nowiki>
  +
<dpl>
  +
category=Community
  +
nottitlematch=%Forums%|Admin%
  +
ordermethod=category,title
  +
headingmode=definition
  +
mode=unordered
  +
listattr= class="submenul"
  +
itemattr= class="submenuli" class="dpl light-background" style= "font-style: italic;"
  +
</dpl>
  +
</nowiki></pre>
  +
|
  +
<dpl>
  +
category=Community
  +
nottitlematch=%Forums%|Admin%
  +
ordermethod=category,title
  +
headingmode=definition
  +
mode=unordered
  +
listattr= class="submenul"
  +
itemattr= class="submenuli" class="dpl light-background" style="font-style: italic;"
  +
</dpl>
  +
|- style="vertical-align:top;"
  +
|<pre><nowiki>
  +
<dpl>
  +
category=Community
  +
nottitlematch=%Forums%|Admin%
  +
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>
  +
</nowiki></pre>
  +
|
  +
<dpl>
  +
category=Community
  +
nottitlematch=%Forums%|Admin%
  +
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]].
+
See also {{dpl3|hitemattr}}.
   
 
=== hitemattr ===
 
=== hitemattr ===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = hitemattr
 
|name = hitemattr
|purpose= 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).
+
|purpose= Adds attributes to HTML list items (headings) at the heading level, depending on {{dpl3|headingmode}} (HTML element would be {{tt|li}} for ordered/unordered, {{tt|div}} for others).
   
To be used with headingmode='unordered' or 'ordered'. (Not yet applicable for others.)
+
To be used with {{dpl3|headingmode|=}}'unordered' or 'ordered'. (Not yet applicable for others.)
 
}}
 
}}
   
Syntax:
+
Syntax:
  +
<code>hitemattr= attribute1="val1" attribute2="val2" ...</code>
 
  +
{{DPL syntax|hitemattr= attribute1="val1" attribute2="val2" ...}}
 
  +
 
Example:
 
Example:
 
{|
 
{|
! '''Input''' !! '''(HTML) Output''' !! '''Actual Output'''
+
! '''Input''' !! '''(HTML) Output''' !! '''Intended Output''' !! '''Actual Output'''
|- valign=top
+
|- style="vertical-align:top;"
 
|<pre><nowiki>
 
|<pre><nowiki>
{{#dpl:
+
<dpl>
  +
category=Community
  +
nottitlematch=%Forums%|Admin%
 
ordermethod=category,title
 
ordermethod=category,title
 
headingmode=unordered
 
headingmode=unordered
 
mode=ordered
 
mode=ordered
 
hlistattr= class="topmenul" id="dmenu"
 
hlistattr= class="topmenul" id="dmenu"
hitemattr= class="topmenuli" style="color: red;"
+
hitemattr= class="topmenuli" class="dpl light-background"
  +
</dpl>
}}
 
 
</nowiki></pre>
 
</nowiki></pre>
 
|<pre><nowiki>
 
|<pre><nowiki>
 
<ul class="topmenul" id="dmenu">
 
<ul class="topmenul" id="dmenu">
<li class="topmenuli" style="color: red;">Category 1 (link)
+
<li class="topmenuli" class="dpl light-background"> Category 1 (link)
<ol>
+
<ol>
<li>Page1_1</li>
+
<li>Page1_1</li>
  +
<li>Page1_2</li>
 
  +
</ol>
<li>Page1_2</li>
 
</ol>
+
</li>
  +
<li class="topmenuli" class="dpl light-background"> Category 2 (link)
</li>
 
  +
<ol>
<li class="topmenuli" style="color: red;">Category 2 (link)
 
  +
<li>Page2_1</li>
<ol>
 
  +
</ol>
<li>Page2_1</li>
 
</ol>
+
</li>
</li>
 
 
</ul>
 
</ul>
 
</nowiki></pre>
 
</nowiki></pre>
 
|
 
|
 
<ul class="topmenul" id="dmenu">
 
<ul class="topmenul" id="dmenu">
<li class="topmenuli" style="color: red;">Category 1 (link)
+
<li class="topmenuli" class="dpl light-background"> Category 1 (link)
<ol>
+
<ol>
<li>Page1_1</li>
+
<li>Page1_1</li>
  +
<li>Page1_2</li>
 
  +
</ol>
<li>Page1_2</li>
 
</ol>
+
</li>
  +
<li class="topmenuli" class="dpl light-background"> Category 2 (link)
</li>
 
  +
<ol>
<li class="topmenuli" style="color: red;">Category 2 (link)
 
  +
<li>Page2_1</li>
<ol>
 
  +
</ol>
<li>Page2_1</li>
 
</ol>
+
</li>
</li>
 
 
</ul>
 
</ul>
  +
|
  +
<dpl>
  +
category=Community
  +
nottitlematch=%Forums%|Admin%
  +
ordermethod=category,title
  +
headingmode=unordered
  +
mode=ordered
  +
hlistattr= class="topmenul" id="dmenu"
  +
hitemattr= class="topmenuli" class="dpl light-background"
  +
</dpl>
 
|}
 
|}
   
 
===userdateformat===
 
===userdateformat===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = userdateformat
 
|name = userdateformat
 
|purpose= Define a special layout for date formatting.
 
|purpose= Define a special layout for date formatting.
Line 849: Line 1,205:
 
Syntax:
 
Syntax:
   
<code>userdateformat=<i>formatstring</i></code>
+
{{DPL 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 [http://www.php.net/manual/en/function.date.php]. The "userdateformat" applies to all date/time fields, see the parameters: [[DPL:Parameters: Controlling Output Volume#addeditdate|addeditdate]],[[DPL:Parameters: Controlling Output Volume#addpagetoucheddate|addpagetoucheddate]],[[DPL:Parameters: Controlling Output Volume#addfirstcategorydate|addfirstcategorydate]]
+
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 [http://www.php.net/manual/en/function.date.php]. The ''userdateformat'' applies to all date/time fields, see the parameters: {{dpl3|addeditdate}},{{dpl3|addpagetoucheddate}},{{dpl3|addfirstcategorydate}}.
   
 
Example:
 
Example:
Line 860: Line 1,216:
   
 
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
 
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
# the timezone preference (difference to UTC/GMT) given by the user in his user settings
+
# the timezone preference (difference to UTC/GMT) given by the user in his user settings.
 
# if no preference is given and for all anonymous users the local time on the server will be used.
 
# if no preference is given and for all anonymous users the local time on the server will be used.
   
Line 872: Line 1,228:
 
===shownamespace===
 
===shownamespace===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = shownamespace
 
|name = shownamespace
 
|purpose= 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.
 
|purpose= 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.
Line 879: Line 1,235:
 
Syntax:
 
Syntax:
   
<code>shownamespace=false</code>
+
{{DPL syntax|shownamespace=false}}
   
 
Example:
 
Example:
  +
<!-- originally, category=Africa, namespace=Talk -->
 
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
|category = Africa
+
category = Help
|namespace = Talk
+
namespace = Help_talk
|shownamespace = false
+
shownamespace = false
  +
</dpl>
}}
 
</nowiki></pre>
+
</nowiki></pre>
   
This list will output all Talk pages in <nowiki>[[Category:Africa]]</nowiki>, listed without the Talk: prepended to page names.
+
This list will output all Talk pages in [[:Category:Help]], listed without the 'Help talk:' prepended to page names.<br/>
  +
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'.<br/>
  +
Only talk pages that have been added to the category (by placing <nowiki>[[Category:Help]]</nowiki> on the talk page) will be listed.
   
  +
<dpl>
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%).
 
  +
category = Help
  +
namespace = Help_talk
  +
shownamespace = false
  +
</dpl>
  +
  +
  +
Note that in {{dpl3|mode|=userformat}} there is a different way to decide whether you want to output the title with or without namespace. In {{dpl3|mode|=userformat}} two built-in variables are provided which contain the page name including the namespace ({{tt|%PAGE%}}) and the base title name ({{tt|%TITLE%}}).
   
   
 
===escapelinks===
 
===escapelinks===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = escapelinks
 
|name = escapelinks
 
|purpose= Regarding ''images'' and ''categories'' this parameter allows you to decide whether
 
|purpose= 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 a link to the image or to the category page ({{dpl3|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)
+
* you want to see the image or make the page which contains the DPL statement part of the categories which are returned by DPL ({{dpl3|escapelinks|=false}})
 
}}
 
}}
   
 
Syntax:
 
Syntax:
:<code>escapelinks=false</code>
 
   
  +
{{DPL 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 [[Test escapelinks|example]] for this on the dpldemo website.
 
  +
  +
Note: You can use this parameter to show images; another way to do this is to use the gallery extension in combination with DPL; there is an {{dpl3|Test escapelinks|example}} for this on the dpldemo website.
   
   
 
===titlemaxlength===
 
===titlemaxlength===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = titlemaxlength
 
|name = titlemaxlength
|purpose= 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 '...'.
+
|purpose= 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 {{dpl3|titlemaxlength}} value, the title is truncated and ended by '...'.
 
}}
 
}}
   
 
Syntax:
 
Syntax:
   
<code>titlemaxlength=<i>number of characters</i></code>
+
{{DPL syntax|titlemaxlength=''number of characters''}}
   
 
===replaceintitle===
 
===replaceintitle===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = replaceintitle
 
|name = replaceintitle
|purpose= execute a string replacement operation on the %TITLE% var
+
|purpose= execute a string replacement operation on the {{tt|%TITLE%}} var
 
}}
 
}}
   
 
Syntax:
 
Syntax:
   
<code>replaceintitle=<i>search for,replacement</i></code>
+
{{DPL syntax|replaceintitle=''search for,replacement''}}
   
The "search for" argument must be an expression which can be used in a php preg_replace() function call.
+
The ''search for'' argument must be an expression which can be used in a php preg_replace() function call.
   
 
Example:
 
Example:
   
 
to remove the string "demo" in article names, you must write
 
to remove the string "demo" in article names, you must write
: replaceintitle=/demo/,
+
: <code>replaceintitle=/demo/,</code>
   
 
Note that standard regexp rules apply. The regexp must start with a non-alphanumeric character -- but not with a backslash!
 
Note that standard regexp rules apply. The regexp must start with a non-alphanumeric character -- but not with a backslash!
Line 948: Line 1,314:
 
===columns===
 
===columns===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = columns
 
|name = columns
 
|purpose= Define a column layout for the output.
 
|purpose= Define a column layout for the output.
Line 955: Line 1,321:
 
Syntax:
 
Syntax:
   
<code>columns=<i>ncols</i></code>
+
{{DPL syntax|columns=''ncols''}}
   
 
'''Example:'''
 
'''Example:'''
   
 
<pre><nowiki>
 
<pre><nowiki>
  +
<dpl></nowiki>
{{#dpl:
 
|category=Test
+
category = Help
  +
nottitlematch = %DPL%
|columns=3
 
  +
includesubpages = false
|rowcolformat=width=100%
 
  +
columns = 3
}}
 
  +
rowcolformat = width=100%
</nowiki></pre>
 
  +
count = 6
  +
</dpl>
  +
</pre>
   
Simply displays all articles and subcategories in [[:Category:Test]] in 3 columns (<tt>[[#rowcolformat|rowcolformat]]</tt> is used to make the table width 100%).
+
Simply displays non-DPL articles and subcategories in [[:Category:Help]] in 3 columns ({{dpl3|rowcolformat}} is used to make the table width 100%).
  +
<dpl>
  +
category = Help
  +
nottitlematch = %DPL%
  +
includesubpages = false
  +
columns = 3
  +
rowcolformat = width=100%
  +
count = 6
  +
</dpl>
  +
Note: {{dpl3|columns}} is currently bugged (possible combatibility issue between [[mw:MediaWiki 1.31|Mediawiki 1.31.2]] and DPL3 v3.3.3) <ref name="columns bug"/>.<br/>
  +
For a 3-column dpl, css can be used to achieve the desired results:
  +
<pre><nowiki>
  +
<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></nowiki></pre>
  +
<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:'''
 
'''More complex example:'''
   
In <tt>[[mode]]=[[userformat]]</tt> the outer tags from <tt>[[#listseparators|listseparators]]</tt> will be repeated for each column.
+
In {{dpl3|mode|=userformat}} the outer tags from {{dpl3|listseparators}} will be repeated for each column.
   
 
<pre><nowiki>
 
<pre><nowiki>
  +
<div style="-webkit-column-count:3;column-count:3;">
{{#dpl:
 
  +
<dpl></nowiki>
|category=Africa
 
  +
category = Help
|addpagesize=true
 
  +
nottitlematch = %DPL%
|ordermethod=size
 
  +
includesubpages = false
|mode=userformat
 
  +
addpagesize = true
|listseparators={|class=sortablewikitable id=2\n!Rank\n!Article\n!Bytes\n|-,\n|%NR%.\n|[[%PAGE%]]\n|align=right|%SIZE%,\n|-,\n|}
 
  +
ordermethod = size
|count=12
 
  +
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=3
 
  +
columns = 2
}}
 
  +
count = 6
</nowiki></pre>
 
  +
</dpl></div>
  +
</pre>
   
The output will contain a list of the 12 largest articles on Africa, arranged in three columns. Each column consists of a table which has itself three columns: rank, article name and size. ''Unfortunately, it doesn't work...''
+
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.
   
  +
<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>
   
 
===rows===
 
===rows===
{{DPL Parameter
+
{{DPL parameter
 
|name = rows
 
|name = rows
|purpose= 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.
+
|purpose= 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 {{dpl3|rowsize}} parameter.
 
}}
 
}}
   
 
Syntax:
 
Syntax:
   
<code>rows=<i>nrows</i></code>
+
{{DPL syntax|rows=''nrows''}}
  +
  +
In {{dpl3|mode|=userformat}}, the outer tags from {{dpl3|listseparators}} will be repeated for each column. Thus you can create long lists where the table heading is repeated from time to time.
   
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:
 
Example:
   
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
|category=Africa
+
category = Help
  +
nottitlematch = %DPL%
|addpagesize=true
 
  +
includesubpages = false
|ordermethod=size
 
  +
addpagesize = true
|mode=userformat
 
  +
ordermethod = size
|listseparators={|class=sortablewikitable id=2\n!Rank\n!Article\n!Bytes\n|-,\n|%NR%.\n|[[%PAGE%]]\n|align=right|%SIZE%,\n|-,\n|}
 
  +
listseparators = {|class=sortablewikitable id=2\n!Rank\n!Article\n!Bytes\n|-,\n|%NR%.\n|[[%PAGE%]]\n|style="text-align:right;"|%SIZE%,\n|-,\n|}
|count=12
 
|rows=2
+
rows = 2
  +
count = 6
}}
 
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
   
The output will contain a list of the 12 largest articles on Africa, arranged in two rows (of 6 lines each). Each row consists of a table which has itself three columns: rank, article name and size.
+
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.
  +
  +
<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>
   
 
===rowsize===
 
===rowsize===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = rowsize
 
|name = rowsize
 
|purpose= Define a row layout for the output. A "row" is a group of n output lines for which the heading will be repeated.
 
|purpose= Define a row layout for the output. A "row" is a group of n output lines for which the heading will be repeated.
Line 1,025: Line 1,448:
 
Syntax:
 
Syntax:
   
<code>rowsize=<i>nrowsize</i></code>
+
{{DPL syntax|rowsize=''nrowsize''}}
   
In "mode=userformat" the outer tags from "listseparators" will be repeated after each group of "rowsize" output lines.
+
In {{dpl3|mode|=userformat}} the outer tags from {{dpl3|listseparators}} will be repeated after each group of {{dpl3|rowsize}} output lines.
 
Thus you can create long lists where the table heading is repeated in regular intervals.
 
Thus you can create long lists where the table heading is repeated in regular intervals.
  +
 
 
Example:
 
Example:
   
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
|category=Africa
+
category = Help
  +
nottitlematch = %DPL%
|addpagesize=true
 
  +
includesubpages = false
|ordermethod=size
 
  +
addpagesize = true
|mode=userformat
 
  +
ordermethod = size
|listseparators={|class=sortablewikitable id=2\n!Rank\n!width=200px|Article\n!Bytes\n|-,\n|%NR%.\n|[[%PAGE%]]\n|align=right|%SIZE%,\n|-,\n|}
 
  +
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=20
 
  +
rowsize = 3
}}
 
  +
count = 6
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
   
The output will contain a list of all articles on Africa. After each group of 20 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.
+
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.
  +
<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>
   
 
===rowcolformat===
 
===rowcolformat===
   
{{DPL Parameter
+
{{DPL parameter
 
|name = rowcolformat
 
|name = rowcolformat
|purpose= Defines layout properties (using [[wikibooks:HTML_Programming/Tables|HTML table tag parameters]]) for the row/column grid.
+
|purpose= Defines layout properties (using [[wikipedia:wikibooks:HTML_Programming/Tables|HTML table tag parameters]]) for the row/column grid.
 
}}
 
}}
   
 
Syntax:
 
Syntax:
   
<code>rowcolformat=<i>html tags</i></code>
+
{{DPL syntax|rowcolformat=''html tags''}}
  +
 
 
Example:
 
Example:
   
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
|category=Africa
+
category = Help
  +
nottitlematch = %DPL%
|columns=3
 
  +
includesubpages = false
|rowcolformat=cellspacing=20
 
  +
columns = 3
}}
 
  +
rowcolformat = cellspacing=20
  +
count = 6
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
   
There will be more space around the columns than normal. See <tt>[[#columns|columns]]</tt> above for another example.
+
There will be more space around the columns than normal. See {{dpl3|columns}} above for another example.
  +
<dpl>
  +
category = Help
  +
nottitlematch = %DPL%
  +
includesubpages = false
  +
columns = 3
  +
rowcolformat = cellspacing=20
  +
count = 6
  +
</dpl>
   
The ideal way to use <tt>rowcolformat</tt> is to assign a CSS class to your DPL table which has been defined in your ''mediawiki:Common.css'' article.
+
The ideal way to use {{dpl3|rowcolformat}} is to assign a CSS class to your DPL table which has been defined in your ''mediawiki:Common.css'' article.
   
 
Example:
 
Example:
   
 
<pre><nowiki>
 
<pre><nowiki>
{{#dpl:
+
<dpl>
|category=Africa
+
category = Help
  +
nottitlematch = %DPL%
|columns=3
 
  +
includesubpages = false
|rowcolformat=class=dpl3columns
 
  +
columns = 3
}}
 
  +
rowcolformat = class=dpl3columns
  +
count = 6
  +
</dpl>
 
</nowiki></pre>
 
</nowiki></pre>
   
In your Common.css article you might have written something like
+
In your ''Common.css'' article you might have written something like
  +
<code>
 
table.dpl3columns td {
+
table.dpl3columns td {
background: #f2f2f2;
+
background: #f2f2f2;
padding: 0.5em;
+
padding: 0.5em;
border:3px;
+
border: 3px;
width:33%;
+
width: 33%;
}
+
}
  +
</code>
 
  +
== References ==
  +
<references><!--{{reflist|-->
  +
<ref name=hitcounters>This feature was completely removed in MediaWiki 1.25, following a request for comment. See {{dpl3|Hit counters removed}}.</ref>
  +
<ref name="columns bug">The columns attribute does not work https://gitlab.com/hydrawiki/extensions/DynamicPageList/issues/81</ref>
  +
</references>
  +
</div>
  +
<!-- Extension prefix in other languages:
  +
  +
[[de:Erweiterung:{{subst:BASEPAGENAME}}]]
  +
[[es:Extensión:{{subst:BASEPAGENAME}}]]
  +
[[fr:Extension:{{subst:BASEPAGENAME}}]]
  +
[[it:Estensione:{{subst:BASEPAGENAME}}]]
  +
[[nl:Uitbreiding:{{subst:BASEPAGENAME}}]]
  +
[[pl:Rozszerzenie:{{subst:BASEPAGENAME}}]]
  +
[[pt:Extensão:{{subst:BASEPAGENAME}}]]
  +
[[ru:Расширение:{{subst:BASEPAGENAME}}]]
  +
[[zh:扩展:{{subst:BASEPAGENAME}}]]
  +
-->

Revision as of 00:23, 10 October 2021

Manual Parameters Controlling output format

You can select one of several default formats or define your own format (mode=userformat); output can be grouped in columns or rows.

In the examples that follow, the DPL output has been kept small to reduce page load time and page size, most notably using titlematch, nottitlematch, count, and includesubpages=false.

General approach to output formatting

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

mode

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=userformat. Note that this mode is automatically implied when listseparators= or format= are used.

mode 'ordered', 'unordered', 'none' (Example1)

These create abbreviated lists of Category:DPL3 pages:

In an <ol>...</ol> list: In a <ul>...</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>
  1. Extension:DPL3/Compatibility
  2. Extension:DPL3/Example: Related to article
  3. User:RheingoldRiver/old dpl manual

mode 'category' (Example2)

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

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


Related configuration option (see Extension:DynamicPageList3 on MediaWiki Wiki: $wgDPL2CategoryStyleListCutoff.

mode 'inline'

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

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

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

Editing  •  New images  •  New pages  •  Random page  •  Undelete  •  Merge history  •  Sorting  •  RevisionDelete  •  Editable tooltips  •  Translation guidelines

mode 'userformat'

listseparators
listseparators (alias for format) see the format parameter. Implicitly sets mode=userformat.
format
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)
  • %COUNT% = the usage counter (requires addpagecounter=true) Removed in MediaWiki 1.25[1]
  • %COUNTFS% = a font size number which is based on the usage counter (currently this is the logarithm of the usage counter) Removed in MediaWiki 1.25[1]
  • %COUNTFS2% = similar to %COUNTFS%, but based on the logarithm of the square root of the usage counter Removed in MediaWiki 1.25 [1]

  • %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


  • %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>

Editing
New images
New pages
Random page

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

<dpl>
  linksto  = DPL
  format   = <ul type="disc">,<li>[[%PAGE%]],</li>,</ul>
</dpl>

Now let us create a table using wiki syntax:

<dpl>
  linksto  = DPL
  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
Gamepedia Help Wiki
Gamepedia Help Wiki/Section 2
Extension:LuaCache
User:Kittymmeow/0
User:Kittymmeow/0/2
User:DSquirrelGM/test/Main Page

We could also produce image galleries:

<dpl>
  namespace = File
  category  = Hydra images|Template images
  count	    = 6
  format    = <gallery widths=20px heights=20px>,%PAGE%\n,,</gallery>
</dpl>
secseparators
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

Please note that the semantics of this parameter have changed with version 0.9.6!. When upgrading to 0.9.6 it will probably be necessary to change the secseparators statements.

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


multisecseparators
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>
Fields cannot be formatted within the include
Page Name Purpose
DPL3/Parameters: Other parameters updaterules define a set of rules which are executed to
deleterules allow the mass deletion of wiki pages
goal set the overall goal for DPL to either show
allowcachedresults Cache query results to improve performance keep
reset suppress references to pages, templates, images,
fixcategory assign the article containing a DPL statement to
eliminate suppress references to pages, templates, images,
debug Sets debugging level.
execandexit process the command given as an argument and then
cacheperiod define the expiration period for the dplcache
DPL3/Parameters: Controlling output order ordermethod Determines what criterion (resp. criteria) is
order Controls the sort direction of the list.
ordercollation Allow individual collations, make case
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}:%TITLE%,{dpl parameter}:name:purpose[50]
 listseparators = ¶{|class="wikitable sortable" ¶!colspan=3|Fields... secseparators¶|-¶!Page ¶!Name ¶!Purpose,¶|-,¶|-¶|class="dpl blue-background" colspan=3|¶|-,¶|}
 secseparators  = ¶|[[%PAGE%|{{#explode:,|:|1}}]],¶|class="dpl dark-background"|,
 include	= {dpl manual}:,{dpl parameter}:name:purpose[50]
 listseparators = ¶{|class="wikitable sortable" ¶!colspan=3|%VARIABLES%... listseparators¶|-¶!Page ¶!Name ¶!Purpose,¶|-¶|[[%PAGE%|{{#explode:%TITLE%|:|1}}]],¶|-¶|class="dpl blue-background" colspan=3|¶|-,¶|}
 secseparators  = ,,¶|class="dpl dark-background"|,,¶|,
These fields are formatted within secseparators
Page Name Purpose
Other parameters updaterules define a set of rules which are executed to
deleterules allow the mass deletion of wiki pages
goal set the overall goal for DPL to either show
allowcachedresults Cache query results to improve performance keep
reset suppress references to pages, templates, images,
fixcategory assign the article containing a DPL statement to
eliminate suppress references to pages, templates, images,
debug Sets debugging level.
execandexit process the command given as an argument and then
cacheperiod define the expiration period for the dplcache
Controlling output order ordermethod Determines what criterion (resp. criteria) is
order Controls the sort direction of the list.
ordercollation Allow individual collations, make case
%TITLE% is added and formatted within listseparators
Page Name Purpose
Other parameters updaterules define a set of rules which are executed to
deleterules allow the mass deletion of wiki pages
goal set the overall goal for DPL to either show
allowcachedresults Cache query results to improve performance keep
reset suppress references to pages, templates, images,
fixcategory assign the article containing a DPL statement to
eliminate suppress references to pages, templates, images,
debug Sets debugging level.
execandexit process the command given as an argument and then
cacheperiod define the expiration period for the dplcache
Controlling output order ordermethod Determines what criterion (resp. criteria) is
order Controls the sort direction of the list.
ordercollation Allow individual collations, make case
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).
  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"|
Includes a phantom template
Page Name Purpose
Other parameters updaterules define a set of rules which are executed to perfor
deleterules allow the mass deletion of wiki pages
goal set the overall goal for DPL to either show pag
allowcachedresults Cache query results to improve performance keep se
reset suppress references to pages, templates, images, c
fixcategory assign the article containing a DPL statement to a
eliminate suppress references to pages, templates, images, c
debug Sets debugging level.
execandexit process the command given as an argument and then
cacheperiod define the expiration period for the dplcache
Controlling output order ordermethod Determines what criterion (resp. criteria) is (res
order Controls the sort direction of the list.
ordercollation Allow individual collations, make case insensitive
Includes a phantom template with Template:nowordbreak
Page Name Purpose
Other parameters updaterules define a set of rules which are executed to
deleterules allow the mass deletion of wiki pages
goal set the overall goal for DPL to either show
allowcachedresults Cache query results to improve performance keep
reset suppress references to pages, templates, images,
fixcategory assign the article containing a DPL statement to
eliminate suppress references to pages, templates, images,
debug Sets debugging level.
execandexit process the command given as an argument and
cacheperiod define the expiration period for the dplcache
Controlling output order ordermethod Determines what criterion (resp. criteria) is
order Controls the sort direction of the list.
ordercollation Allow individual collations, make case

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>


See also Test article structure.

dominantsection
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

table

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

Now look at the examples

tablerow

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.

The tablerow command is best explained by an example:

<dpl>
  category=Help
  titlematch=DPL%
  count=4
  includepage ={DPL Manual}:section,%-1[25]
  table       =,Title,Sub Title,Last Section (25 chars)
  tablerow    =style="text-align:center;background-color:lightyellow;"|%%,|%%,
</dpl>

The following example includes the use of addpagecounter and %COUNT%, both of which were removed in MediaWiki 1.25.

<dpl>
  category=African Union member states
  nottitlematch=Sudan
  addpagecounter=true
  includepage ={Infobox Country or territory}:area:population_estimate,%0[100]
  format      =,,\n|style="text-align:right;"|²{#ifexpr:%COUNT%>300¦<big>'''%COUNT%'''</big>¦%COUNT%}²,
  table       =,Country,Area,Population,Text,#hits
  tablerow    =style="text-align:right;"|%%,style="text-align:right;"|%%,style="background-color:lightyellow;"|<small>%%</small>,\n|style="text-align:right;"|%%
</dpl>
  • We select some African countries, we exclude Sudan
  • We acquire a piece of meta data about the articles we will find (in our case the usage counter)
  • We include two named parameters from a template call, {{Infobox Country or territory}}
  • We include a short text passage from the text before the first chapter
  • We use the third parameter of format to output the usage counter (we could even highlight values above 100 here, for example)
  • We highlight usage values above 300
  • We define a standard wiki table with the article name in the first column (named "Country")
  • We define column headers for transcluded contents and for the usage counter
  • We care for right alignment of the numerical values and define a bgcolor for the text

tablesortcol

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

headingmode

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=Terraria Wiki|Community
  notcategory=Games
  nottitlematch=%d%|Disambiguations
  count=7
  ordermethod=category,title
  headingmode=definition
  mode=ordered
</dpl>

This list will output pages that belong to one of the categories Terraria Wiki, Community 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 Actual Output
<dl>
  <dt>Category</dt>
  <dd>
    <ol>
      <li>Page1</li>
      <li>Page2</li>
    </ol>
  </dd>
</dl>
Community
  1. Category:Achievements
  2. Category:User groups
  3. Category:User languages
  4. Email
  5. Gamepedia Help Wiki:Community portal
  6. Site notice
  7. Wiki avatars

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

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

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 Actual Output
<dpl>
category=Community
nottitlematch=%Forums%|Admin%
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>
Community
Editing
Gamepedia policies
Guides
<dpl>
category=Community
nottitlematch=%Forums%|Admin%
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>
Community
Editing
Gamepedia policies
Guides

itemattr

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

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 Actual Output
<dpl>
category=Community
nottitlematch=%Forums%|Admin%
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>
Community
  1. Category:Guidelines
  2. Site notice
  3. Category:User groups
  4. Category:Achievements
  5. Category:User languages
  6. Email
  7. Gamepedia Help Wiki:Community portal
  8. Wiki avatars
  9. User:AttemptToCallNil/Admin guide
  10. Wiki Discord servers
  11. New to moderating
Editing
  1. New to moderating
Gamepedia policies
  1. Category:Guidelines
Guides
  1. New to moderating

These examples compare listattr, itemattr, and hlistattr

Input Actual Output
<dpl>
category=Community
nottitlematch=%Forums%|Admin%
ordermethod=category,title
headingmode=definition
mode=unordered
listattr= class="submenul" class="dpl light-background"
itemattr= class="submenuli" style= "font-style: italic;"
</dpl>
Community
Editing
Gamepedia policies
Guides
<dpl>
category=Community
nottitlematch=%Forums%|Admin%
ordermethod=category,title
headingmode=definition
mode=unordered
listattr= class="submenul"
itemattr= class="submenuli" class="dpl light-background" style= "font-style: italic;"
</dpl>
Community
Editing
Gamepedia policies
Guides
<dpl>
category=Community
nottitlematch=%Forums%|Admin%
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>
Community
Editing
Gamepedia policies
Guides

See also hitemattr.

hitemattr

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=Community
nottitlematch=%Forums%|Admin%
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

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

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

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; there is an example for this on the dpldemo website.


titlemaxlength

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

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

columns

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) [2].
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.

rows

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. Category:Special pages 49
2. Category:Wiki roles 51
3. Category:Examples 96
4. Category:Personal customization 105
5. Category:Reading 160
6. Category:Editing 181

rowsize

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. Category:Special pages 49
2. Category:Wiki roles 51
3. Category:Examples 96
4. Category:Personal customization 105
5. Category:Reading 160
6. Category:Editing 181

rowcolformat

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

References

  1. 1.0 1.1 1.2 This feature was completely removed in MediaWiki 1.25, following a request for comment. See Hit counters removed.
  2. The columns attribute does not work https://gitlab.com/hydrawiki/extensions/DynamicPageList/issues/81