Changes

Jump to: navigation, search

Help:DPL

5,470 bytes added, 14:36, 30 June 2006
Outpout
{{H:h|Editor toc}}
[[m:DynamicPageList|DynamicPageList]] or short DPL is a MediaWiki extension supporting intersections and other set operations of pages belonging to several categories.

== Flavours ==

Two versions of dynamic page lists (DPL) exist, an older variant using tags <tt>&lt;dynamicpagelist&gt;</tt> plus <tt>&lt;/dynamicpagelist&gt;</tt>,
and an advanced variant using tags <tt>&lt;dpl&gt;</tt> plus <tt>&lt;/dpl&gt;</tt>. A project can support none, one , or both of these two extensions,
see "parser extension tags" in [[Special:Version]].

The advanced version covers all functions of the older variant, here only the latter is explained. For further details see the descriptions in
[[m:DynamicPageList|DynamicPageList]] and [[m:DynamicPageList2|DynamicPageList2]].

== Operation ==

In essence categories are sets of related pages, created by adding <tt>[&#91;Category:common property&#93;]</tt> to the individual pages. In
addition [[Help:category|category]] pages are also ordinary pages in their first part with all features of normal pages, but their main purpose is to list
all pages belonging to the category. This changes as soon as <tt>[&#91;Category:common property&#93;]</tt> is added or removed from one or more of the
individual pages, the members of this set.

Watching the category page only tracks modifications to its first part (as for any ordinary page), but it doesn't show any additions or removals of
member pages. DPLs address this missing feature, they also allow to sort member pages by various criteria where categories only offer a crude
''sort key'' or alphabetical order.

Simple DPLs start with <tt>&lt;dynamicpagelist&gt;</tt> followed by one or more <tt>category=name</tt> and optionally other parameter=value pairs,
and they are terminated by <tt>&lt;/dynamicpagelist&gt;</tt>. For a similar construct see [[Help:inputbox|inputbox]].

One (first) <tt>category=name</tt> is required, and it's the base for some other attributes. Adding more <tt>category=name</tt> restricts the DPL
to pages in the intersection of all specified categories.

With <tt>notcategory=name</tt> pages in that category are removed from the DPL. So for categories A, B, and C use <tt>category=A</tt> and
<tt>category=B</tt> with <tt>notcategory=C</tt> for all pages in both A and B, but not C. And also not only in A, and not only in B.

Two DPLs could be used to get a kind of union, the first DPL for category A, and the second DPL for category B without A, but real unions
require the advanced DPL features.

== Restrictions ==

The attribute <tt>namespace=</tt> allows to restrict listed pages to a [[Help:namespace|namespace]] given by its number or name. Use '''0''' for the main namespace.

The attribute <tt>redirects=</tt> can be ''exclude'' (default) not listing any redirects belonging to the selected categories. With ''include'' redirects
are listed, and <tt>redirects=only</tt> limits the DPL to only redirects.

With <tt>counts=</tt>''n'' the DPL is limited to the first ''n'' member pages as determined by the sort order (see below). The default is a system-wide
maximum, with two DPLs looking at the same set from both ends it's indirectly posssible to determine if really all selected pages are shown (see below).

== Output ==

Use <tt>suppresserrors=true</tt> to suppress error messages for an empty DPL, e.g. if the selected category doesn't exist.

The default output <tt>mode=unordered</tt> presents the DPL as unordered list, XHTML <tt>&lt;ul&gt;</tt>, like Wiki list markup '''<tt>*</tt>'''.

Similarly ''ordered'' results in numbered <tt>&lt;ol&gt;</tt> output like Wiki list markup '''<tt>#</tt>'''. Finally <tt>mode=none</tt> presents
the DPL with one entry per line, terminated with <tt>&lt;br&#160;/&gt;</tt>, rougly similar to Wiki list markup '''<tt>;</tt>''' (semicolon).

Especially in conjunction with <tt>namespace=</tt> the attribute <tt>shownamespace=false</tt> allows to suppress the output of the namespace.

== Sorting ==

DPLs are either sorted by the date of the additiion to the first category (this is often '''not''' the date of the creation of the
individual page), the default <tt>ordermethod=categoryadd</tt>, or by <tt>ordermethod=lastedit</tt>, the date of the last modification of the
member pages.

Sorting can be <tt>order=descending</tt> (default, most recent first) or <tt>order=ascending</tt>, allowing to look at the same set from both
ends in two DPLs (see above).

== Dates ==

With <tt>addfirstcategorydate=true</tt> the date of the addition to the first category is shown.

== Example ==

''If the following example doesn't work where you read this page look at it on [[m:Help:DPL|Meta]].''

&lt;dynamicpagelist&gt;
category=Reader handbook
order=ascending
ordermethod=lastedit
mode=ordered
shownamespace=false
&lt;/dynamicpagelist&gt;

This results in a numbered list of help pages, oldest first:

<dynamicpagelist>
category=Reader handbook
order=ascending
ordermethod=lastedit
mode=ordered
shownamespace=false
</dynamicpagelist>

Another example:

&lt;dynamicpagelist&gt;
category=Handbook templates
notcategory=Templates using ParserFunctions
mode=none
addfirstcategorydate=true
&lt;/dynamicpagelist&gt;

This creates a plain list with the dates of the addition to the first (here only) category:

<dynamicpagelist>
category=Handbook templates
notcategory=Templates using ParserFunctions
mode=none
addfirstcategorydate=true
</dynamicpagelist>

{{H:f|enname=DPL}}
Anonymous user

Navigation menu