Help:DPL Manual/Criteria for page selection


 * You can select articles based on
 * the category/categories they are assigned to
 * the number of categories they are assigned to
 * their namespace
 * their usage of templates
 * their title
 * their references to other articles
 * their character (#redirect or normal article)
 * their revision date


 * You can restrict the number of articles to a certain limit
 * via configuration settings within the DPL2 source
 * via a specific parameter for a given invocation of DPL2


 * You can select a subset from the result list by random

category
Syntax:

or or

You can either use the pipe symbol for logical OR or you can use the & symbol for logical AND. Mixing both is not possible! If you specify more than one line their arguments will be implicitly connected with AND. Thus you can build a logical expression where you have several AND terms with each term consisting of an OR group of categories.

Attention: the command uses the pipe symbol to delimit its arguments (logical OR). When using DPL with parser function syntax you MUST escape the pipe character by a template (which is typically called "!") or you must use the broken pipe symbol ("¦"):

Example 1:

 category=Africa|Europe category=Politics and conflicts 

or

or

This list will output pages that have OR, AND  listed.

You can specify the set of Uncategorized pages as a normal category, with the keyword  (e.g. ' ' for uncategorized pages only, ' ' or ' ' for the Uncategorized or the Animals category, ' ' for the Mammals category, uncategorized pages or the Insects category, etc.). See Source and Installation for the extra required installation steps.

If ,... and 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.

Example 2:

 category=+Africa|Europe category=**Politics and conflicts ordermethod=category,sortkey headingmode=ordered 

This list will output pages that have OR, AND (  or a direct subcategory or a second level subcategory of the latter ) listed. The list will be ordered (OL tag) and organized in 2 main items/headings: the Africa one and the Europe one (Politics and conflicts or its resp. subcategories will not be used as a heading). Under each item/heading you will see a sublist of pages ordered by their sortkey for the category used as heading.

Notes:

If you want to use magic words like August, 27, 2024 etc in the category name, you must use the parser function syntax variant.

To prevent a DPL query from returning huge output (or consuming too many resources) there are some configuration variables in the source code of the extension module like,  ,.

Using the category statement without an argument will have no effect (note that in previous DPL versions this acted like category=_none_).

categorymatch
Syntax:

A "%" is used to denote "any number of any characters".

Example 1:

 categorymatch=Africa%|Europe% 

This list will output pages that belong to categories like Africa, Africans, Europe, Europeans etc.

categoryregexp
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
Syntax:

Example:

 category=Africa notcategory=Zimbabwe notcategory=Kenya 

This list will output pages that have but do not have either  or  listed.

Notes:

If you use the parser function syntax you will be able to use Magic words like August, 27, 2024 etc in the category name.

Related DPL extension variables:,  ,.

categoriesminmax
Syntax:

Example:

 category=Africa categoriesminmax=3 

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

 category=Africa categoriesminmax=,1 

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

namespace
Syntax:

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. ' ' for pages in Main ns only, ' ' or ' ' for Main or Talk ns, ' ' for User, Main or Category, etc.).

Name spaces are case sensitive   will work, but   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:

 category=Policy namespace=Wikinews|Discussion 

This list will output pages that are in the Wikinews or Discussion namespace and belong to.

Example 2 (with magic word):

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

notnamespace
Syntax:

Example 1:

 notnamespace=Wikinews notnamespace=Discussion 

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

Example 2 (with magic word):

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

linksfrom
Syntax:

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

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

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 parameter can be used to control the amount of output you get.

openreferences
Syntax:

Example 1:  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
Syntax:

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

linksto
Syntax:

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

This list will output pages that are in "Poets" and link to a page with title Dublin or Cork (or Cornwall etc.) in the Main  (by default). To make the comparison case-insensitive, use the parameter. 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)

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

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

notlinksto
Syntax:

Example:  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 parameter can be used to control the amount of output you get.

linkstoexternal
Syntax:

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

imageused
Syntax:

Example:  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
Syntax:

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

uses
Syntax:

The "Template" namespace must be specified. You can also specify another namespace if you like.

Example 1:  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
Syntax:

Example 1:  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
Syntax:

Example 1:  usedby=Main Page </DPL>

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

createdby
Syntax:

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

Note:

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

modifiedby
Syntax:

Note:

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

notmodifiedby
Syntax:

Note:

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

lastmodifiedby
Syntax:

notlastmodifiedby
Syntax:

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, , and  for details.

title
Syntax:

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:

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&lt;
Syntax:

The string given need not be a valid page title.

If this parameter is set together with 'ASCENDING' order and a 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&gt;
Syntax:

The string given need not be a valid page title.

If this parameter is set together with 'ASCENDING' order and a 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
Syntax:

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

Example:

 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:

 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. Note that spaces are translated to \_ (escaped underscore) as MediaWiki internally stores names with underscores instead of spaces. Using an underscore in your argument means 'any single character' in SQL LIKE expressions.

titleregexp
Syntax:

Example:

 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 to make the comparison case-insensitive.

nottitlematch
Syntax:

Example:

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

includematch
Syntax:

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.

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 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 parameter. And see Talk:Test_includematch.

Example:

 category = Africa includepage = #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 statement. "KAMERUN" would not match; we could use the "i" modifier with the regexp to match without case sensitivity if we wanted so.

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

includenotmatch
Syntax:

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

Example:

 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 includepage statement. "KAMERUN" would not match; we could use the "i" modifier with the regexp to match without case sensitivity if we wanted so.

includenotmatchparsed
works exactly like 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
Syntax:

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

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

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

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

number must be greater or equal than 1.

minrevisions
Syntax:

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.

articlecategory
Syntax:

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

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

redirects
Syntax:

criteria can be one of:
 * exclude &mdash; excludes redirect pages from lists &mdash; (default)
 * include &mdash; allows redirect pages to appear in lists
 * only &mdash; lists only redirect pages in lists

Example:

 category = Africa redirects = include </DPL>

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

minoredits
Requires:

Example:

criteria can be one of:
 * exclude &mdash; ignore minor edits when sorting lists
 * include &mdash; includes minor edits to sort lists &mdash; (default)

Example:

 category=Africa ordermethod=lastedit minoredits=exclude </DPL>

This list will order pages tagged with by lastedit, but minor edits will be ignored in the ordering.

stablepages
Syntax:

default is.

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

default is.

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.

count
Syntax:

, with  a positive integer

A blank value for unlimited. It is limited to 500 by default, depending on extension variables:,.

Example:

<DPL> category=Africa ordermethod=pagetouched count=2 </DPL>

This list will output the two pages most recently changed that have.

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

scroll
Syntax:

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

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

, with  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
Syntax:

, with  a positive integer

Example:

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

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

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

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

ignorecase
Syntax:

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

The parameter has an effect on, , , and their  -equivalents.

For case-insensitivity in ordering result sets see.

skipthispage
Syntax:

The default is, 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).