Utente:Wedhro/Sandbox/Aiuto:DPL

Vai alla navigazione Vai alla ricerca

Questa è una guida avanzata all'uso dei DPL che ci vorrà un bel po' a finire perché è complicata. Ci sono parti in inglese perché devo ancora finire di tradurla, e manca ancora un sacco di roba che devo trovare.

Una Dynamic Page List (lista di pagine dinamica) è uno strumento del Maligno concepito per compilare automaticamente liste "intelligenti" di pagine; almeno, più intelligenti delle bombe americane. Lo scopo ovviamente è quello di lavorare meno per avere più tempo da dedicare ad attività utili al sito, come inviare faccine con fiorellini/cuoricini alle utentesse.

Un DPL si usa inserendo nella pagina in cui dovrà comparire una "funzione parser" assegnandoli parametri ben precisi, che appare così:

 {{#dpl:
 | parametro1 = valore1
 | parametro2 = valore2
 }}

Ci sono 2 tipi fondamentali di parametri che contraddistinguono ogni ricerca fatto tramite DPL (3, contando anche le bestemmie): i criteri da dare al DPL in modo che trovi le pagine giuste; e il modo in cui esso visualizzerà i risultati.

NB: in questa pagina non troverai veri DPL di esempio funzionanti perché sono pesanti per il server, e ce ne vorrebbero così tanti da inchiodarti quella merda di browser che usi.

Criteri di ricerca

Si deve inserire almeno un criterio di ricerca, altrimenti il DPL non troverà nulla e vi guarderà come un cummenda guarda un barbone alla stazione della metro. Inserendone più d'uno il DPL troverà le pagine che rispettano tutti i criteri dati; ci sono comunque modi per trovare pagine che rispettino un criterio oppure un altro.

category

Cerca pagine che rientrino in una o più categorie. La ricerca su una sola categoria trova pagine che rientrino in quella categoria, senza curarsi del fatto che rientri o meno in altre. NB: non devi scrivere categoria:vattelapesca ma solo vattelapesca.

 {{#dpl:
 | category = vattelapesca
 }}

Si possono anche cercare pagine senza categoria, specificando come categoria _none_ (occhio ai trattini bassi). Non basta lasciare il parametro vuoto, ciò non produrrà alcun risultato.

and/or

Per una ricerca più complessa si possono usare parametri logici, dove la barretta verticale | rappresenta un OR e l'e commerciale & rappresenta un AND. Per i digiuni di logica (visto che succede a pensare solo alla figa e al pallone?), OR vuol dire che basta si verifichi almeno una delle condizioni date, mentre AND richiede che si verifichino tutte.

 {{#dpl:
 | category = vattelapesca|minchiate|abominii
 }}

Cerca le pagine che rientrino in categoria:vattelapesca oppure categoria:minchiate o ancora categoria:abominii.

{{#dpl:
 | category = vattelapesca&minchiate&abominii
 }}

Questa invece cerca pagine che rientrino in tutte e 3 le categorie di cui sopra.

Si può fare una ricerca ancor più complessa inserendo più volte il parametro category. Ognuno di essi si considera in AND con gli altri, in questo modo puoi specificare diversi gruppi di criteri che si devono verificare tutti insieme.

 {{#dpl:
 | category = vattelapesca
 | category = abominii|minchiate
 }}

Questa cerca le pagine che sono in categoria:vattelapesca e anche in almeno una fra categoria:minchiate o categoria:abominii.

If ordermethod=category,... and headingmode are enabled, you can restrict the categories you want as headings in the result by preceding the list of categories (specified with the category parameter) with a '+' or '-'. See the example below.

  • A '+' means that only the categories listed in that statement are allowed to appear as headings in the output.
  • A '-' means that the categories listed in that statement are NOT allowed to appear as headings in the output (but all others)

If you put a "*" before the name of a category, DPL will add all DIRECT subcategories of that category to your statement. Using TWO asterisks ("**") will extend the tree search to two levels. This provides some minimal support for hierarchies of categories. The syntax and/or semantics of this feature might be changed in a future version.

Notes:

If you want to use magic words like {{CURRENTMONTHNAME}}, {{CURRENTDAY}}, {{CURRENTYEAR}} etc in the category name, you must use the parser function syntax variant.

categorymatch

È simile a #category ma invece di cercare in specifiche categorie verifica che la pagina compaia in categorie che hanno certe seguenz di caratteri nel nome. Questo richiede l'uso del segno percentuale % da usare come "jolly" e rappresenta un qualunque numero di caratteri qualsiasi. Ad esempio "ca%ata" troverà sia "cazzata" che "cagata". Ciò è utilissimo per fare ricerche in tante categorie simili senza doverle scrivere una per una, cosa che toglie troppo tempo alla pulizia dell'ombelico.

La barretta verticale | anche qui è usata come OR.

 {{#dpl:
 | categorymatch = %pesca%|minchi%
 }}

Troverà la pagine in categoria:vattelapesca, categoria:pesca, categoria:pescatori, categoria:minchiate, o categoria: minchie enormi.

categoryregexp

Template:DPL parameter

The complete text behind "categoryregexp" will be taken as ONE argument and used in a SQL REGEXP clause, i.e. "|" characters can be used as a normal part of the regexp.

notcategory

Template:DPL parameter

Syntax:

notcategory=category name

Example:

DPL
  category=Africa
  notcategory=Zimbabwe
  notcategory=Kenya
DPL

This list will output pages that have [[Category:Africa]] but do not have either [[Category:Zimbabwe]] or [[Category:Kenya]] listed.

Notes:

If you use the parser function syntax you will be able to use Magic words like {{CURRENTMONTHNAME}}, {{CURRENTDAY}}, {{CURRENTYEAR}} etc in the category name.

Related DPL extension variables: $wgDPL2MaxCategoryCount, $wgDPL2AllowUnlimitedCategories, $wgDPL2MinCategoryCount.

notcategorymatch

Template:DPL parameter

notcategoryregexp

Template:DPL parameter

categoriesminmax

Template:DPL parameter

Syntax:

categoriesminmax=[min],[max]

Example:

DPL
  category=Africa
  categoriesminmax=3
DPL

The list will only contain articles which belong to category "Africa" and at least to two other categories

DPL
  category=Africa
  categoriesminmax=,1
DPL

The list will only contain articles which belong to category "Africa" and are not assigned to any other category.


Select articles based on NAMESPACES

namespace

Template:DPL parameter

Syntax:

namespace=1st namespace name|2nd namespace name|3rd namespace name|...

The namespace name may be any one, assuming it represents a valid namespace in the system, including custom ones, BUT no pseudo-namespace such as Media, Special which have negative namespace ids. The empty string is the main article namespace (e.g. 'namespace=' for pages in Main ns only, 'namespace=|Help' or 'namespace=Talk|' for Main or Talk ns, 'namespace=User||Category' for User, Main or Category, etc.).

Name spaces are case sensitive namespace=User_talk will work, but namespace=User_Talk will not.

Instead of using the title of a namespace you can also use its numeric ID - although this is not recommended. DPL will always try to interpret the argument as a name first. So, if you create a user namespace with the title "1" (which is possible in principle) DPL will take this namespace if given a "1" as an argument. In this case the "Talk" namespace (which has the numeric id '1') cannot be specified by its number but only by the literal "Talk".

Example 1:

DPL
  category=Policy
  namespace=Wikinews|Discussion
DPL

This list will output pages that are in the Wikinews or Discussion namespace and belong to [[Category:Policy]].

Example 2 (with magic word):

  {{#dpl: category = Policy | namespace= {{NAMESPACE}} }}

This list will output pages that are in the namespace the current page is in - whatever it is - and belong to [[Category:Policy]].

notnamespace

Template:DPL parameter

Syntax:

notnamespace=namespace name

Example 1:

DPL
  notnamespace=Wikinews
  notnamespace=Discussion
DPL

This list will output pages that are NEITHER in the Wikinews NOR in the Discussion namespace.

Example 2 (with magic word):

  {{#dpl: notnamespace = Wikinews | notnamespace = {{NAMESPACE}} }}

This list will output pages that are NEITHER in the Wikinews NOR in the namespace the current page is in.


Select articles based on LINKS

linksfrom

Template:DPL parameter

Syntax:

linksfrom=full page name|..

The page mentioned in the DPL query can be retrieved via %PAGESEL%.

Example 1:

DPL
  category = Poets
  linksfrom  = Dublin|Cork
DPL

This list will output pages that are mentioned (with a hyperlink) in article Dublin or Cork in the Main namespace and which belong to category "Poets".

Example 2 (with magic word):

  {{#dpl: category = Poets | linksfrom = {{FULLPAGENAME}} }}

This list will output pages that are in category "Poets" and which are referenced by the current page, whatever it is. Note that normally 'linksfrom' will only show existing pages. With 'openreferences=yes' this can be changed.

Note that the distinct parameter can be used to control the amount of output you get.

openreferences

Template:DPL parameter

Syntax:

openreferences=yes

Example 1:

DPL
  linksfrom  = Dublin|Cork
  openreferences=yes
DPL

This list will output pages that are mentioned (with a hyperlink) in article Dublin or Cork in the Main namespace, regardless whether these pages exist or not.

Note that the vast majority of DPL parameters depend on the existence of a page. If you set openreferences to 'yes' none of those parameters can be used. Examples for conflicting parameters are all parameters which relate to categories, revisions, authors, redirections and some other parameters.

Note that you must specify ordermethod=none if you want to use openreferences=yes.

notlinksfrom

Template:DPL parameter

Syntax:

notlinksfrom=full page name|..

Similar to linksfrom, you could use the {{FULLPAGENAME}} Magic Word, and not include any pages linked to from the current page. This, however, will generally result in errors.

linksto

Template:DPL parameter

Syntax:

linksto=full page name|..

The page mentioned in the DPL query can be retrieved via %PAGESEL%.

A %-sign can be used as a wildcard (SQL-LIKE expression).

If you specify more than one linksto condition they will act as a logical AND. In this case the %PAGESEL% variable will point to the FIRST condition.

Example

Parser extension
DPL
  category = Poets
  linksto  = Dublin|C%r%
DPL
Parser function
{{#dpl: category = Poets | linksto = Dublin{{!}}C%r%}}

This list will output pages that are in category "Poets" and link to a page with title Dublin or Cork (or Cornwall etc.) in the Main namespace (by default). To make the comparison case-insensitive, use the parameter ignorecase. Note the use of {{!}} as a template call to "|" in order for multiple values in parameters when using DPL as a parser function (otherwise DPL would interpret "|Cork" as another parameter, and give an error).

If a page links to Cork and Cornwall it will appear twice in the output. Use %PAGESEL% to see thename of the page it links to.

Example 2 (with magic word)

  {{#dpl: category = Poets | linksto = {{FULLPAGENAME}} }}

This list will output pages that are in category "Poets" and link to the current page, whatever it is.

Note that the distinct parameter can be used to control the amount of output you get.

notlinksto

Template:DPL parameter

Syntax:

notlinksto=full page name|..

Example:

DPL
  category   = Poets
  notlinksto = London|Paris
DPL

This list will output pages that are in category "Poets" and do not have a link pointing to a page with title London or Paris in the Main namespace.

Note:

The implementation of this feature is not very efficient. Use with care and avoid huge result sets.

Note that the distinct parameter can be used to control the amount of output you get.


linkstoexternal

Template:DPL parameter

Syntax:

linkstoexternal=text pattern|..

This command selects pages which contain external http links that match a certain pattern. The pattern is used in SQL LIKE expression, i.e. _ and % are treated as special symbols that match any character respecting a group of arbitrary characters.

The pattern is case-sensitive!

The pattern is matched against the whole URL. Therefore you need to put % around the pattern if you only give part of the string:

 linkstoexternal=%mywebpage%

If you specify more than one linkstoexternal item, a page must match ALL conditions (logical AND).

The URL of the external link can be retrieved via %EXTERNALLINK%.

See also the addexternallink command.

imageused

Template:DPL parameter

Syntax:

imageused=image name|..

Example:

DPL
  imageused = My.gif | Your image.png | Image:His.jpg
DPL

As you can see the Namespace 'Image' need not be specified.

Note: There is a variable %IMAGESEL% which contains the image name(s) used for selection.


imagecontainer

Template:DPL parameter

Syntax:

imagecontainer=page name|..

Example:

DPL
  imagecontainer = MyPage | YourPage
  escapelinks=false
  openreferences=true
DPL

This statement will show all images which are contained in the two articles MyPage and YourPage. Normally we would only get the names of images that really exist. But because we have specified openreferences=true we will also see non-existing images. Normally we would get a list of image names. Setting the parameter escapelinks to false, however, causes that we will see existing images directly. Non existing images will be displayed as red links.

See example.

Select articles based on the use of TEMPLATES

uses

Template:DPL parameter

Syntax:

uses=Template:name|Template:.. The "Template" namespace must be specified. You can also specify another namespace if you like.

Example 1:

DPL
  uses = Template:Poet|Template:Painter
DPL

This list will output pages that use a template called Poet and/or another template called "Painter".

It is not possible to find pages that use 2 templates (e.g. Template:Foo AND Template:Bar).

notuses

Template:DPL parameter

Syntax:

notuses=Template:name|Template:..

Example 1:

DPL
  category = Poet
  notuses = Template:Poet
DPL

This list will output pages about poets which do not use the corresponding template.

Caution:

The implementation of this feature is not very efficient. Use with care and avoid huge result sets.


usedby

Template:DPL parameter

Syntax:

usedby=page

Example 1:

DPL
  usedby=Main Page
DPL

This will create a list of all pages which are included by the main page of your wiki.

Select articles based on authors / editors

createdby

Template:DPL parameter

Syntax:

createdby=username

Note (applies for all user related selection criteria):

  • You can combine user related selections. For example you could search for pages which were not created by user1 but modified by him, or you could search for pages which were created by user1 and lastmodified by user. You can also show several or all versions of such articles by specifiying one or more of the "revision" group of parameters like allrevisionsbefore.
  • currently there is no mechanism to make a distinction between minor edits and normal modifications

notcreatedby

Template:DPL parameter

Syntax:

notcreatedby=username

Note:

To avoid huge result sets this will typically be accompanied by other selection criteria.

modifiedby

Template:DPL parameter

Syntax:

modifiedby=username

Note:

modifiedby will always be a superset of createdby as the creation of a page is interpreted as its first modification.

notmodifiedby

Template:DPL parameter

Syntax:

notmodifiedby=username

Note:

To avoid huge result sets this will typically be accompanied by other selection criteria.


lastmodifiedby

Template:DPL parameter

Syntax:

lastmodifiedby=username

notlastmodifiedby

Template:DPL parameter

Syntax:

notlastmodifiedby=username

Note:

To avoid huge result sets this will typically be accompanied by other selection criteria.


Select articles based on TITLE

There are several possibilities to select articles by their title. When the titles of matching articles are displayed later in the output list their names can be shown in different ways: The namespace may be shown or skipped and even parts of the name can be changed. See shownamespace, replaceintitle, escapelinks and titlemaxlength for details.


title

Template:DPL parameter

Syntax:

title=pagetitle

If you specify a "title", the "mode" will be automatically set to "userformat" which means that you will get no output by default. Specifying an exact "title" makes sense if you want to transclude contents from one specific other page, e.g. the whole text, a chapter, labeled sections or template calls.

Thus DPL may serve as a more flexible alternative to Labeled Section Transclusion.

Examples:

{{#dpl:title=My Page|include=#First Chapter}}
{{#dpl:title=My Page|include={My Template}.dpl|multisecseparators=\n----\n}}

The first example will include the contents of "My Chapter" of an article named "My Page" in the main namespace.

The second example will take all invocations of template "My Template" in article "My Page" and apply "Template:My Template.dpl" instead of "Template:My Template". The output will be separated by horizontal lines.


title<

Template:DPL parameter

Syntax:

title<=string

The string given need not be a valid page title.

If this parameter is set together with 'ASCENDING' order and a count limit, you will get the pages which are immediately 'below' the given string. This allows efficient scrolling through huge result sets.

For details see Scrolling.


title>

Template:DPL parameter

Syntax:

title>=string

The string given need not be a valid page title.

If this parameter is set together with 'ASCENDING' order and a count limit, you will get the pages which are immediately 'above' the given string. This allows efficient scrolling through huge result sets.

For details see Scrolling.

scroll

Template:DPL parameter

Syntax:

scroll=yes

If this command is given, DPL will interpret some special arguments in the URL.

DPL_count       limit number of pages to show
DPL_offset      where to start (nth page)
DPL_refresh     whether to purge the special DPL cache or not 
DPL_fromTitle   page name to start after (will be passed to title< ) 
DPL_toTitle     page name to end with (will be passed to title> , needed for reverse scroll) 
DPL_findTitle   page name to start with (will be passed to title>= ) 
DPL_scrolldir   direction of scroll (can be 'up' or 'down') 

For details see Scrolling.

titlematch

Template:DPL parameter

Syntax:

titlematch=pattern|..

Example:

DPL
  titlematch=%foo%|bar%
DPL

This will output all pages (regardless of namespace) which have a name that contains "foo" somewhere in the title or start with "bar"

Example:

DPL
  namespace=
  titlematch=A%
DPL

This will output all pages in the main namespace which begin with "A".

The match is case-sensitive, even with respect to the first character; to make it case-insensitive, use the parameter ignorecase. Note that spaces are translated to \_ (escaped underscore) as MediaWiki internally stores names with underscores instead of spaces. Using an underscore in your titlematch argument means 'any single character' in SQL LIKE expressions.

titleregexp

Template:DPL parameter

Syntax:

titleregexp=regular expression

Example:

DPL
  titleregexp=[0-9]+.*y$
DPL

This will output all pages (regardless of namespace) which have a digit in their name and end with a "y". Use the parameter ignorecase to make the comparison case-insensitive.

nottitlematch

Template:DPL parameter

Syntax:

nottitlematch=pattern|..

Example:

DPL
  nottitlematch=%e%|%u%
DPL

This will output all pages (regardless of namespace) which do not contain an "e" or a "u" in their title.


nottitleregexp

Template:DPL parameter

Syntax:

nottitleregexp=regular expression

Select articles based on CONTENTS

includematch

Template:DPL parameter

Syntax:

includematch=regexp1,regexp2,..

The idea is that a page will only be selected (and its contents included) if the contents to be included matches a regular expression. In case of (heading based) chapter inclusion and labeled section inclusion the relevant contents of the page must match the pattern; in case of template based matching it is the complete wikitext of the calling code of your template which is tested against your regular expression. Be careful to design your regexp in a proper way so that it can match all syntactical variations and note that we use Perl regular expressions. This means that you must delimit your regexp with two identical characters that are not part of the regexp itself, e.g. with /. Otherwise you will see strange error messages from the php interpreter...

If you are not familiar with regular expressions and/or do not know the specifics of Perl regexp used in PHP, you should definitely have a look into the PHP manual before using includematch.

You may want to match named parameters or unnamed parameters. In the first case you should use something like

 includematch=/\{{!}}\s*myParameter\s*=\s*myPattern/s

to be on the safe side. Thus you can put spaces around the = and use linebreaks in your original article when calling the template - and still the pattern will match. Note that you must use a template to produce a pipe symbol - otherwise the pipe will break the parameter structure of your DPL call.

In case the template expects unnamed parameters you would specify something like

 includematch=/\|\s*myPattern/s

If the parameter is not the last one in your template call you might use

 includematch=/\{{!}}\s*myPattern\s*\|/s

Note that in combination with templates the regexp matching will only work if you produce some output at all via the include statement. So, if you call a dummy parameter only or if you call a phantom template that does not produce any output, you will see no matches. It is, however, sufficient to produce a space character to get output. It is not necesssary to output the parameter which matches your regexp.

See the include parameter. And see Talk:Test_includematch.

Example:

DPL
  category  = Africa
  include  = #myChapter,{countryProfile}.dpl
  includematch = ,/Name\s*=\s*[Kk]amerun/s
DPL

This will match articles which contain a call to the template "countryProfile" and use the "Name" parameter of that template with an argument that contains "Kamerun" or "kamerun" as a text string. Note that there is no pattern specified for the first element of the include statement. "KAMERUN" would not match; we could use the "i" modifier with the regexp to match without case sensitivity if we wanted so.

includematchparsed

Template:DPL parameter

works exactly like includematch but the contents will be parsed before it is tested against the regular expression.

includenotmatch

Template:DPL parameter

Syntax:

includenotmatch=regexp1,regexp2,..

The idea is that a page will only be selected (and its contents included) if the contents to be included does not match a given regular expression. In case of (heading based) chapter inclusion and labeled section inclusion the relevant contents of the page must not match the pattern; in case of template based matching it is the calling code of your template which must not match the regular expression. Be careful to design your regexp in a proper way so that it covers all syntactical variations. You should use something like

includenotmatch=myParameter\s*=\s*myPattern/s

to be on the safe side. Thus you can put spaces around the '=' and use linebreaks in your original article when calling the template - and still the pattern will do its job.

See the include parameter.

Example:

DPL
  category  = Africa
  include  = #myChapter,{countryProfile}.dpl
  includenotmatch = ,/Name\s*=\s*[Kk]amerun/s
DPL

This will match articles which contain a call to the template "countryProfile" and use the "Name" parameter of that template with an argument that does not contain "Kamerun" or "kamerun" as a text string. Note that there is no pattern specified for the first element of the include statement. "KAMERUN" would not match; we could use the "i" modifier with the regexp to match without case sensitivity if we wanted so.

includenotmatchparsed

Template:DPL parameter

works exactly like includenotmatch but the contents will be parsed before it is tested against the regular expression.

Select articles based on REVISION dates

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 revision date/time.


lastrevisionbefore

Template:DPL parameter

Syntax:

lastrevisionbefore=dateandoptionaltime

dateandoptionaltime is a numeric string of up to 14 digits, like "200812041300" (4th of Dec, 2008, 13:00). The string may contain separation characters like "2008/12/04--13:00".

Note: if this parameter is used the variable %REVISION% will contain the revision of the selected page(s).

firstrevisionsince

Template:DPL parameter

Syntax:

firstrevisionsince=dateandoptionaltime

dateandoptionaltime is a numeric string of up to 14 digits, like "200812041300" (4th of Dec, 2008, 13:00) The string may contain separation characters like "2008/12/04--13:00".

Note: if this parameter is used the variable %REVISION% will contain the revision of the selected page(s).

allrevisionsbefore

Template:DPL parameter

Syntax:

allrevisionsbefore=dateandoptionaltime

dateandoptionaltime is a numeric string of up to 14 digits, like "200812041300" (4th of Dec, 2008, 13:00) The string may contain separation characters like "2008/12/04--13:00".

Note: if this parameter is used the variable %REVISION% will contain the revision of the selected page(s).

allrevisionssince

Template:DPL parameter

Syntax:

allrevisionssince=dateandoptionaltime

dateandoptionaltime is a numeric string of up to 14 digits, like "200812041300" (4th of Dec, 2008, 13:00) The string may contain separation characters like "2008/12/04--13:00".

Note: if this parameter is used the variable %REVISION% will contain the revision of the selected page(s).


maxrevisions

Template:DPL parameter

Syntax:

maxrevisions=number

number must be greater or equal than 1.


minrevisions

Template:DPL parameter

Syntax:

minrevisions=number

number must be greater or equal than 1. In practice only values of 2 or greater make sense. Using a value of 2, you could exclude freshly created pages from a result set.

Select articles based on OTHER criteria

articlecategory

Template:DPL parameter

Syntax:

articlecategory= categoryname

If you want to select articles in namespace=Talk you can use this statement to define (in addition) a category for an article with identical name in namespace 0 (default namespace).

includesubpages

Template:DPL parameter

Syntax:

includesubpages=false

As subpages are by default always included, only 'no' or 'false' makes sense as an argument for includesubpages.


redirects

Template:DPL parameter

Syntax:

redirects=criteria

criteria can be one of:

  • exclude — excludes redirect pages from lists — (default)
  • include — allows redirect pages to appear in lists
  • only — lists only redirect pages in lists

Example:

DPL
  category  = Africa
  redirects = include
DPL

The result will consist of content pages and redirect pages tagged with [[Category:Africa]]. Note: this parameter does not show pages that link to the redirect (as Special:Whatlinkshere/DPL:Discussion does); only redirect pages themselves.


minoredits

Template:DPL parameter

Requires: ordermethod=[...]firstedit|lastedit

Example:

minoredits=criteria

criteria can be one of:

  • exclude — ignore minor edits when sorting lists
  • include — includes minor edits to sort lists — (default)

Example:

DPL
category=Africa
ordermethod=lastedit
minoredits=exclude
DPL

This list will order pages tagged with [[Category:Africa]] by lastedit, but minor edits will be ignored in the ordering.


stablepages

Template:DPL parameter

Syntax:

stablepages= include | exclude | only

default is include .

Purpose:

This parameter is only useful if your wiki uses Extension:FlaggedRevisions. It allows you to control whether pages flagged as 'stable' will be part of the DPL result or not.



qualitypages

Template:DPL parameter

Syntax:

qualitypages= include | exclude | only

default is include .

Purpose:

This parameter is only useful if your wiki uses Extension:FlaggedRevisions. It allows you to control whether pages flagged as 'quality pages' will be part of the DPL result or not.

Restrict the output volume

count

Template:DPL parameter

Syntax:

count=n, with n a positive integer

A blank value (count=) for unlimited. It is limited to 500 by default, depending on extension variables: $wgDPL2MaxResultCount, $wgDPL2AllowUnlimitedResults.

Example:

DPL
category=Africa
ordermethod=pagetouched
count=2
DPL

This list will output the two pages most recently changed that have [[Category:Africa]].

If 'count' is missing it can be set from outside via the URL parameter DPL_count.

scroll

Template:DPL parameter

Syntax:

scroll=yes

Huge result sets can be split into smaller parts. DPL allows you to fetch parts of a huge result set by setting auxiliary selection criteria ([[title<]], [[title>]]). DPL_Example_027 demonstrates the principle. It uses a scroll helper template which generates links to scroll forward and backward through a long result list. To make this possible it relies on variables which give the name of the first and last result item actually shown. The command scroll=yes is used to fill these variables with proper values and to set the title limits according to URL parameters derived from these variables.

see also Scrolling.

Example:

see DPL_Example_027

offset

Template:DPL parameter

Syntax:

offset = n with n = number of result lines to skip, (integer), default = 0

Example:

DPL
  category=Africa
  offset = 10
  count  =  5
DPL

This will show articles #11 .. #15 of category Africa; order is determined by alphabet as we did not give any specific ordermethod.

Note:

  1. You could put a DPL query into a template and make count & offset parameters. Calling this template with different values will allow you to display different portions of the result list.
  2. if you use mode=ordered the numbers will be adjusted to reflect the absolute position of the entries, i.e. in the above example you will see numbers starting from 11.

If 'offset' is missing it can be set from outside via the URL parameter DPL_offset.

randomcount

Template:DPL parameter

Syntax:

randomcount=n, with n a positive integer

If randomcount is larger than the number of results, the complete result set will be displayed.

Example:

DPL
  category=Africa
  ordermethod=size
  count=20
  randomcount=3
DPL

This list will output three random articles from the group of the 20 largest articles on Africa.


randomseed

Template:DPL parameter

Syntax:

randomseed=n, with n a positive integer

Example:

{{#dpl:
  |category=Africa
  |randomcount=3
  |randomseed={{#time:Ymd}}
}}

This will set the random seed to a new value every day. Using this on your homepage you could present a stable set of random articles for one day and switch to another set every day.

distinct

Template:DPL parameter

Syntax:

distinct=true | false | strict

Normally distinct is set to true. This means that a page will occur only once in the output.

In connection with linksto and linksfrom, however, a page can occur more than once in the output. This happens if you specify more than one page for the linksfrom/linksto parameter and the same page contains links to more than one of them (linksto) or if the same page is referenced by more than one of them (linksfrom). If you want see a page only once also in these cases, use distinct=strict.

On the other hand, if you wish to see mutiple result entries you should switch this to false. This may make sense in combination with linksto or linksfrom if you want to see how many links from one document to another document exist.


ignorecase

Template:DPL parameter

Syntax:

ignorecase=true

The default is case sensitivity. So only true makes sense as an argument.

The parameter has an effect on linksto, uses, titlematch, titleregexp and their not-equivalents.

For case-insensitivity in ordering result sets see ordercollation.

skipthispage

Template:DPL parameter

Syntax:

skipthispage=no

The default is yes, i.e. the page where your DPL query stands will never show up in the result set. Setting this parameter to 'no' may lead to runtime errors which are hard to track down. You should only use that parameter if your query is straight forward in its structure and you need the current page to show up in the result (if it matches the selction criteria).


Visualizzazione dei risultati

Mode

 {{#dpl:
 |mode = MODALITÀ
 }}
 

unordered

È la modalità preimpostata.

none

Elenco non puntato.

ordered

Elenco puntato.

none

Elenco non puntato.

inline

I risultati sono messi in linea, senza andare a capo.

 {{#dpl:
 |mode = inline
 |inlinetext = SEPARATORE
 }}
 

Separatore è un qualunque wikitesto che sarà usato per separare i risultati messi in linea. Se non specificato, è &nbsp;-&nbsp;, ovvero un trattino separato da spazi.

NB: gli spazi all'inizio e alla fine del wikitesto sono ignorati, per quello bisogna usare i codici HTML per gli spazi.

category

Elenco formattato come una pagina di categoria, quindi con risultati incolonnati e divisi in ordine alfabetico. Il parametro ordermethod è obbligatorio.

userformat

Risultati formattati secondo indicazioni date, il che permette risultati sofisticati come tabelle ecc.


mode 'Userformat'

listseparators

Template:DPL parameter Note that format= automatically implies mode=userformat whereas listseparators does not.

format

Template:DPL parameter

Note1: listseparators is an alias for format which does not automatically imply mode=userformat.

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 the string \n 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:

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

  • %COUNT% = the usage counter (requires addpagecounter=true)
  • %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)
  • %COUNTFS% = a font size number which is based on the usage counter (currently this is the logarithm of the usage counter)
  • %COUNTFS2% = similar to %COUNTFS%, but based on the logarithm of the square root of the usage counter.
  • %EDITSUMMARY% = the change log message of a revision; only accessible if the DPL query is based on revisions.

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

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

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

  • %REVISION% = the name of the revision of the article; this will only be available if you made a selection based on revisions

  • %EXTERNALLINK% = the external hyperlink found as a consequence of the 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 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% : These variables contain namespace and title of the first / last articel in the result set; the information is intended to be used for page scrolling
  • %SCROLLDIR% : The value of this variable is 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 DPL2 can also be produced with the following statements:

Example:

DPL
  category = Africa
  format   = ,\n* [[%PAGE%|%TITLE%]],,
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.

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

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

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

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

Now let us create a table using wiki syntax:

DPL
  linksto        = Africa
  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.

we could also produce image galleries:

DPL
  namespace = Image
  format    = <gallery>,%PAGE%\n,,</gallery>
DPL

secseparators

Template:DPL parameter

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 secseparator 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 symbol %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 secseparator tags will only be put once around the whole block (but see dominantsection).

Example

DPL
  linksto        = Africa
  mode           = userformat
  listseparators = {|¶!pages found¶!fruit¶!color,¶|-¶|[[%PAGE%]],,¶|}
  includepage    = #fruit,#color
  secseparators  = ¶|,,¶|,,
DPL

Which produces, DPL

 linksto        = Africa
 mode           = userformat
 listseparators = {|¶!pages found¶!fruit¶!color,¶|-¶|%PAGE%,,¶|}
 includepage    = #fruit,#color
 secseparators  = ¶|,,¶|,,

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 "fruit", 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
  linksto          = Africa
  mode             = userformat
  listseparators   = {|\n!pages found\n!fruit\n!color,\n|-\n|[[%PAGE%]],,\n|}
  includepage      = #fruit[50],#color[100 more..]
  secseparators    = \n|
DPL

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.

multisecseparators

Template:DPL parameter

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 symbol %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
  category=TestSSt
  includepage={interfaces_overview} dpl
  mode=userformat
  listseparators=¶{|class=sortable ¶!Interface ¶!Source system ¶!Target system ¶!Technology,¶|-¶|[[%PAGE%]] ¶,¶,¶|}
  secseparators  = \n|
  multisecseparators=¶|-¶|&nbsp;|
DPL

See also Test article structure.

dominantsection

Template:DPL parameter

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

Template:DPL parameter

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

Template:DPL parameter

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" to make sure that the field contents is 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 (you can also find this example on the title page of this wiki):

DPL
  category=African Union member states
  nottitlematch=Sudan
  addpagecounter=true
  includepage ={Infobox Country or territory}:area:population_estimate,%0[100]
  format      =,,\n|align=right|²{#ifexpr:%COUNT%>300¦<big>'''%COUNT%'''</big>¦%COUNT%}²,
  table       =,Country,Area,Population,Text,#hits
  tablerow    =align=right|%%,align=right|%%,bgcolor=lightyellow|<small>%%</small>,\n|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

Template:DPL parameter

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

Template:DPL parameter

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"
  • H3 — outputs sections — HTML tags "H3"
  • H4 — outputs sections — HTML tags "H4"

Example:

DPL
  category=Africa|Europe
  ordermethod=category,title
  headingmode=definition
  mode=ordered
DPL

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

<dl>
  <dt>Africa</dt>
  <dd>
    <ol>
      <li>Page1</li>
      <li>Page2</li>
    </ol>
  </dd>
  <dt>Europe</dt>
  <dd>
    <ol>
      <li>Page1</li>
    </ol>
  </dd>
</dl>

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

headingcount

Template:DPL parameter

Syntax:

headingcount=true

default is headingcount=false


listattr

Template:DPL parameter

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

Examples:

Input (HTML) Output Actual Output
DPL
ordermethod=category,title
headingmode=ordered
mode=none
listattr= class="submenul"
itemattr= class="submenuli" style="font-style: italic;"
DPL
<ol>
  <li> 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> 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>
  1. Cat1 (link)
  2. Cat2 (link)
DPL
ordermethod=category,title
headingmode=ordered
mode=unordered
listattr= class="submenul"
itemattr= class="submenuli" style="font-weight: bold;"
DPL
<ol>
  <li> Cat1 (link)
    <ul class="submenul">
      <li class="submenuli" style="font-weight: bold;"> Page1_1 </li> 
      <li class="submenuli" style="font-weight: bold;"> Page1_2 </li>
    </ul>
  </li>
  <li> Cat2 (link)
    <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>
  1. Cat1 (link)
  2. Cat2 (link)

itemattr

Template:DPL parameter

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

Example: see listitemattr.

hlistattr

Template:DPL parameter

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

Example:

Input (HTML) Output Actual Output
DPL
ordermethod=category,pagetouched
headingmode=H2
mode=ordered
hlistattr= class="topmenul" id="dmenu"
DPL
<div class="topmenul" id="dynamicmenu">
  <H2> Category 1 (link) </H2>
  <ol>
      <li>Page1_1</li>
      <li>Page1_2</li>
  </ol>
  <H2> Category 2 (link) </H2>
  <ol>
      <li>Page2_1</li>
  </ol>
</div>

Category 1 (link)

  1. Page1_1
  2. Page1_2

Category 2 (link)

  1. Page2_1

See also hitemattr.

hitemattr

Template:DPL parameter

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

Example:

Input (HTML) Output Actual Output
DPL
ordermethod=category,title
headingmode=unordered
mode=ordered
hlistattr= class="topmenul" id="dmenu"
hitemattr= class="topmenuli" style="color: red;"
DPL
<ul class="topmenul" id="dmenu">
  <li class="topmenuli" style="color: red;"> Category 1 (link)
    <ol>
      <li>Page1_1</li>
      <li>Page1_2</li>
    </ol>
  </li>
  <li class="topmenuli" style="color: red;"> 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

Template:DPL parameter

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

Template:DPL parameter

Syntax:

shownamespace=false

Example:

DPL
  category      = Africa
  namespace     = Talk
  shownamespace = false
DPL

This list will output all Talk pages in [[Category:Africa]], listed without the Talk: prepended to page names.

Note that in "mode=userformat" there is a different way to decide whether you want to output the title with or without namespace. In mode=userformat two built-in variables are provided which contain the page name including the namespace (%PAGE%) and the base title name (%TITLE%).


escapelinks

Template:DPL parameter

Syntax:

escapelinks=false

Note: You can use this parameter to show images; an other way to do this is to use the gallery extension in combination with DPL; there is an example for this on the dpldemo website.


titlemaxlength

Template:DPL parameter

Syntax:

titlemaxlength=number of characters

replaceintitle

Template:DPL parameter

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

Template:DPL parameter

Syntax:

columns=ncols

Example:

DPL
  category=Test
  columns=3
  rowcolformat=width=100%
DPL

Simply displays all articles and subcategories in Category:Test in 3 columns (rowcolformat is used to make the table width 100%).

DPL

 category=Test
 columns=3
 rowcolformat=width=100%

DPL

More complex example:

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

DPL
  category=Africa
  addpagesize=true
  ordermethod=size
  mode=userformat
  listseparators={|class=sortablewikitable id=2\n!Rank\n!Article\n!Bytes\n|-,\n|%NR%.\n|[[%PAGE%]]\n|align=right|%SIZE%,\n|-,\n|}
  count=12
  columns=3
DPL

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

DPL

 category=Africa
 addpagesize=true
 ordermethod=size
 mode=userformat
 listseparators={|class=sortablewikitable id=2\n!Rank\n!Article\n!Bytes\n|-,\n|%NR%.\n|%PAGE%\n|align=right|%SIZE%,\n|-,\n|}
 count=12
 columns=3

DPL

rows

Template:DPL 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=Africa
  addpagesize=true
  ordermethod=size
  mode=userformat
  listseparators={|class=sortablewikitable id=2\n!Rank\n!Article\n!Bytes\n|-,\n|%NR%.\n|[[%PAGE%]]\n|align=right|%SIZE%,\n|-,\n|}
  count=12
  rows=2
DPL

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.

rowsize

Template:DPL parameter

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=Africa
  addpagesize=true
  ordermethod=size
  mode=userformat
  listseparators={|class=sortablewikitable id=2\n!Rank\n!width=200px|Article\n!Bytes\n|-,\n|%NR%.\n|[[%PAGE%]]\n|align=right|%SIZE%,\n|-,\n|}
  rowsize=20
DPL

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.

rowcolformat

Template:DPL parameter

Syntax:

rowcolformat=html tags

Example:

DPL
  category=Africa
  columns=3
  rowcolformat=cellspacing=20
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=Africa
  columns=3
  rowcolformat=class=dpl3columns
DPL

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

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