Templat:DPL
This template generates a dynamic page list (DPL), a list of all pages meeting some specified criteria, with optional parameters for substantially the full range of DPL options, and default values suited to Wikibooks.
Usage
[sunting]The following parameters are supported. Each one is optional, but there must be either a cat, or a not, or namespace; and there's an upper limit on the total number of cats and nots (when last noted, the limit was six).
- cat1, cat2, cat3, cat4, cat5 — categories that a page must belong to in order to be listed. The more of these are specified, the fewer pages will qualify for the list.
- not1, not2, not3, not4, not5 — categories that a page must not belong to, in order to be listed. The more of these are specified, the fewer pages will qualify for the list.
- namespace — namespace a page must belong to in order to be listed; to restrict to mainspace, use main.
- stable — how to treat pages that have at least one sighted revision; include treats them no differently than any other page, only lists only sighted pages, and exclude lists only unsighted pages; the default is usually include, but if namespace specifies Wikijunior the default is only.
- Note, the Wikijunior default stable=only is relied upon at Wikijunior to prevent listing of unvetted pages.
- offset — integer number of pages to omit at the start of the list, default being zero.
- count — integer number of pages to list, default being the maximum list length allowed by the extension (a setting in the extension).
- If a specified count is larger than the maximum list length allowed by the extension, this template attempts to provide the requested length by piecing together multiple lists; see {{DPL/0}}.
- showerrors — if non-blank, errors are reported (mainly, "There are no pages matching this query"); by default, errors produce no visible output.
- full — if false, the namespace of pages is not shown (only the {{PAGENAME}} of each page is listed); if any other non-blank value, the namespace of pages is shown; default depends on whether parameter namespace is specified — if it is specified, default is false, otherwise default is true.
- method — how the list is ordered; default is categorysortkey, alternatives are categoryadd (when pages were mostly recently added to the first category in the query) and lastedit (when pages were most recently edited).
- order — whether to show the list forward (ascending) or backward (descending); default is ascending.
- showdate — if non-blank, shows the date when each page was added to the first category (even if method=lastedit).
- mode — what kind of list to generate; default is an unordered list, i.e., each page is preceded by a bullet; alternatives are ordered, i.e., the pages are numbered (1, 2, 3, ...), and none.
Internals
[sunting]Parameter defaults are coded in {{DPL/simple}}. Requests for extended maximum list length are dispatched to {{DPL/0}}.
See also
[sunting]These templates have more limited functionality, and somewhat different interfaces; relatively unobvious interface differences, that could cause difficulties when converting to {{DPL}}, are listed below.
- {{CategoryList}}
- {{CategoryJunction}}
- {{CategoryIntersection}}
Parameter stable is unsupported by two of these, and called stablepages by {{CategoryJunction}} with default always include (no exception for Wikijunior). Parameter showerrors is called errors. Parameter full always defaults to false.