Help:Editing/DPL guide

From the RuneScape Wiki, the wiki for all things RuneScape
Jump to: navigation, search
Crystal saw.png
This page is currently under construction.
The information contained within should not be considered fully accurate and/or complete.
Information icon.svg This guide is written for use with the Source Mode editor.
If you have not already switched to the Source Mode editor you can find out how to here.

DynamicPageList3 (also known as DynamicPageList (third party), usually shortened to DPL3 or just DPL), is a powerful tool for generating lists of pages based on a query. It can also output the data in many ways, the most basic of which is a bullet point list suitable for copy-pasting into an AWB list.

The main drawback of DPL is that it can significantly increase load times; in general it should be somewhat avoided for a general mainspace page.

This page is just my reinterpretation of the manual now that I have experience. I will only be covering the basics and useful commands, with some worked examples. For full details, see the main reference manual. I am also assuming you know wikicode reasonably well.

Syntax in this guide[edit source]

For clarity, throughout this guide I will use code formatting when referring to parameters. For example, 'category' in "add the category to category" would first refer to some category, and then the formatted category refers to the parameter.

In respect to DPL, the 'parameter' is an entire part of a query, with the parameter name on the left of the =, and the parameter value on the right. I'll generally refer to the parameter value as just 'value' unless I need to be specific.

In prose, I'll refer to logical operators in capitals - AND OR NOT XOR etc.

Example DPL queries will use the following format and styling:

Short explanation of the query (with links to relevant categories etc)
dpl call in preformatted text
Result of the DPL call

Basics[edit source]

Explanation[edit source]

DPL is effectively an editor-level database query tool. You build a query, which the DPL extension then interprets and gets the pages from the database, and formats the results as required.

That makes it sound a lot more complex that it really is.

Want a list of pages in a category in reverse alphabetical order? Sure.
Want to see what pages are in a given category that also use a specific template? Fine.
Want pages where the title matches a regular expression? Done.
Want to generate a dynamic database of equipment with custom filters? Why not.
Pages by creation date? Pages by last edit? etc etc etc

Invocation[edit source]

DPL can be invoked in two ways. Most of the time, there is no difference between the two methods, but some more complex things result in a variance between the two.

Extension tags

The first method uses extension tags:

<dpl>
param1 = value1
param2 = value2
...
</dpl>

Extension tags have each parameter on a new line.

Parser functions (and other such wikitext) in the query are not evaluated in extension tags. If you need to use them, you must use the other invocation. In most parameters, escape characters are not required, but will work fine (though you'll need to use a newline escape).

In general I will be using this method.

Parser function

The parser function method is called like any other parser function:

{{#dpl:
|param1 = value1
|param2 = value2
...
}}

Parser function syntax requires a pipe to separate each parameter. They do not need to be on a new line, but conventionally they are for clarity. (The first parameter does not need a pipe, but I usually include one for clarity.)

Escape characters are generally required for parameters in the parser function invocation. General-use parser functions and wikitext will also be evaluated before the query, so this is the required method for templating, nesting, and complex filtering.

Escape characters[edit source]

As mentioned above, DPL includes several escape characters which are often required. I will mention them when I use them below.

MediaWiki character DPL escape Alt code Usage
< « Alt+174 Calling another extension inside an output parameter (see #include)
> » Alt+175
{{ ²{ Alt+253 then { Calling a template/parser inside an output parameter (see #include)
}} } then Alt+253
| ¦ Alt+0166
UK keyboards: Alt Gr (right alt) + ` (adjacent to 1)
Used in templates, or when | is used as an 'or' character in params
newline \n \ n Inserts a newline so that things that need to start on a line (like * # tables etc) work correctly
Alt + 0182

Simple queries[edit source]

First off, some simple queries. These sorts of queries are just intersections of various lists (categories, whatlinkshere, etc), output as a list.

As an upfront, to save on processing time, I will be using the count parameter for all queries. The count parameters limits the maximum output of a query to the value given - see #Limiting result set size for details.

Basic filters[edit source]

Category[edit source]

To list pages present in one category, you use the category parameter. Without a specified order (see later section), pages are listed in alphabetical order of PAGENAME (title without namespace).

Pages in Category:Items
<dpl>
category = Items
count = 5
</dpl>


Combining - AND

Categories can be combined in two ways - OR (the pages are in at least one of the categories) and AND (the pages are in all of the categories). All parameters to a DPL call are implicitly ANDed together, so you can easily select pages that are in all of two or more categories:

Pages in all of
<dpl>
category = Head slot items
category = Tier 90 equipment
category = Magic armour
count = 5
</dpl>

Alternatively you can use one parameter, and join categories together using an ampersand &.

Pages in all of
<dpl>
category = Head slot items&Tier 90 equipment&Magic armour
count = 5
</dpl>

I tend to prefer the first.

Combining - OR

Categories can only be ORed together in one parameter. This works just like the second AND method above, but the character for doing so is a pipe | instead - though this will need to be escaped with ¦ in the parser function syntax (I suggest doing it in the tag syntax too). There is no (simple) XOR function.

Pages in either of
<dpl>
category = Skill masters¦Elves
count = 5
</dpl>


Combining - both

You cannot combine an AND and an OR in one parameter; however, as parameters are implicitly ANDed, you can AND together some ORed groups.

Pages in all of
<dpl>
category = Head slot items¦Torso slot items
category = Tier 90 equipment
category = Magic armour
count = 5
</dpl>

However, your query can't be more complex than (OR group) AND (OR group) AND ..... There just isn't a way to join together parameters in that way - consider using multiple queries for that.

Not category[edit source]

As its name implies, the notcategory parameter does the reverse of the category parameter - it selects pages that are not in the specified category. You should avoid using notcategory without any other filters, as you may end up selecting the entire wiki.

Pages in all of

but not in Category:Magic armour

<dpl>
category = Head slot items¦Torso slot items
category = Tier 90 equipment
notcategory = Magic armour
count = 5
</dpl>

Unlike category, you cannot use any in-line logical operators - | and & will simply do nothing. Of course, you can still AND two or more notcategory parameters together. (Remember, not(a) & not(b) = not(a | b).)

Pages in all of

but not in Category:Magic armour and not in Category:Ranged armour

<dpl>
category = Head slot items¦Torso slot items
category = Tier 90 equipment
notcategory = Magic armour
notcategory = Ranged armour
count = 5
</dpl>

Namespace[edit source]

Namespaces are an easy way to filter nonsensical results out of a results set. For this we use the namespace parameter. By default all namespaces are included. Namespaces must be referred to by their name, which is case-sensitive (namespace=user talk will not work). The main namespace is referred to using the empty string. Namespaces can be ORed together using a pipe, just like categories.

Categories in Category:Equipment
<dpl>
category = Equipment
namespace = Category
count = 5
</dpl>

Namespaces can be excluded in the same way as categories, using notnamespace

Links here filters[edit source]

What links here[edit source]

Pages can be selected by their 'what links here', i.e. pages that link to a specific page. This does not include transclusion (see next section for that) or file uses (see the section after that), and won't include redirects by default (see below for that).

Pages linking to Abyssal whip in File namespace
<dpl>
linksto = Abyssal whip
namespace = File
count = 5
</dpl>

Like categories, this can be inverted with notlinksto.

What transcludes this[edit source]

Similar to the above, the uses parameter uses the 'what links here', but only uses transclusions (i.e. template uses). As transclusion works on any namespace, you do need to include the namespace when specifying which page you want to consider (i.e. use uses = Template:Infobox Item, not uses = Infobox Item.

Uses of Template:Infobox Monster new
<dpl>
uses = Template:Infobox Monster new
count = 5
</dpl>

uses also works correctly for module invocations:

Uses of Module:Infobox Item
<dpl>
uses = Module:Infobox Item
count = 5
</dpl>

Again, it can be inverted using notuses.

What uses image[edit source]

Another similar function is imageused, which does what links here for file uses. You can omit the namespace in this one, since file uses only work for the file namespace.

Uses of Abyssal whip.png in mainspace
<dpl>
imageused = Abyssal whip.png
namespace =
count = 5
</dpl>

There is no inverter for imageused - notimageused does not exist.

Page type filters[edit source]

Redirects[edit source]

By default redirects are excluded when selecting pages. You can set the redirects parameter to exclude (default) to remove them, include to add them to the results, or only to only consider redirects.

Pages that redirect to Abyssal whip
<dpl>
linksto = Abyssal whip
redirects = only
count = 5
</dpl>

Subpages[edit source]

By default subpages are included when selecting pages. You can set the includesubpages parameter to true (default) to include them, false to remove them from results sets.

Category:Guides that aren't subpages
<dpl>
category = Guides
includesubpages = false
count = 5
</dpl>

Order and scrolling[edit source]

Limiting result set size[edit source]

The amount of results you get in a query is determined by the count parameter. The maximum and default for this is 500.

5 pages that link to abyssal whip
<dpl>
linksto = Abyssal whip
count = 5
</dpl>
1 page that links to abyssal whip
<dpl>
linksto = Abyssal whip
count = 1
</dpl>

If you wish to get more than 500 results, you will need to use multiple queries on one page, with the offset parameter (see next section). Be aware that there will be a hard limit reached eventually - the page transclusion size limit, which is around 2 MB. You may be able to do 3000+ results on one page if its just a basic bullet list, or you may struggle to reach 1000 if you fetch a lot of information via include.

Page scrolling[edit source]

You can 'scroll' through results numerically using the offset. This will 'chop off' the first x results so that you continue from where it was. You may want to enforce a sort method for this to make real sense.

5 pages that link to abyssal whip, offset by 4
<dpl>
linksto = Abyssal whip
count = 5
offset = 4
</dpl>

Order[edit source]

Order of results is controlled by two parameters: ordermethod, which determines by what metric the results are sorted, and order, which determines the direction.

The default method is unspecified - what order they appear in may depend on the primay selection condition (e.g. whatlinkshere based filters are in alphabetical, category selectors by the category order, etc), or it may be in pagetouched or size order. If a method is specified, the default direction is ascending (i.e. earliest first, A first, smallest first, etc).

Multiple order methods can be specified by comma-separating them.

Standard order methods
  • title - ordered by FULLPAGENAME
  • titlewithoutnamespace - ordered by PAGENAME
  • size - size (in bytes) of the wikitext of the page
  • firstedit - ordered by page creation
  • lastedit - ordered by most recent edit
  • sortkey - the same order of the first category parameter (requires a category parameter)
Predefined multisort - sorts by the first one, then the second one
  • category,firstedit
  • category,lastedit
  • category,pagetouched
  • user,firstedit
  • user,lastedit
Others
  • pagetouched - internal timestamp for when the page was most recently 'touched' by the server (distinct from editing)
  • pagesel - order based on linksfrom/linksto page
  • categoryadd - by time of addition to the category (cannot mix with other filter types)
  • none - required for openreferences
  • counter - does not work as we do not use the dependency for it
Examples
Items in reverse alphabetical
<dpl>
category = Items
namespace =
ordermethod = title
order = desc
count = 5
</dpl>
Recent updates
<dpl>
category = Updates by date
ordermethod = sortkey
ordermethod = desc
count = 5
</dpl>
First pages in mainspace
<dpl>
namespace = 
ordermethod = firstedit
order = asc
count = 5
</dpl>

Advanced selectors[edit source]

These selectors are a little more advanced and aren't always something you need to use - but they are also fairly powerful for when you do need them.

Title matching[edit source]

Title matching is done with the titlematch and nottitlematch parameters. These use SQL LIKE syntax:

  • The entire PAGENAME is checked
  • _ is a wildcard for any one character
  • % is a wildcard for any number of characters (including 0)
  • You can OR together multiple matches with |

This allows you to have simple filters for PAGENAME. Title matching does not match namespaces (use the namespace param for that).

Mainspace pages ending in brackets
<dpl>
namespace = 
titlematch = % (%)
count = 5
</dpl>
Single character pages, including redirects, in reverse name order
<dpl>
namespace = 
titlematch = _
redirects = include
ordermethod = title
order = desc
count = 5
</dpl>

As it matches the entire pagename, you can select a single page with titlematch, if you just need to extract information from that page.

Just noxious staff - without namespace filter
<dpl>
titlematch = Noxious staff
count = 5
</dpl>
Just noxious staff
<dpl>
namespace =
titlematch = Noxious staff
count = 5
</dpl>

Modules[edit source]

Using modules in DPL[edit source]

As mentioned in the include section, you can have DPL format results through a template. This template in turn could be through a module. In general, this will result in it being a little faster for the same result (if well written), or allowing access to more functions.

See the lua guide on how to write lua.

Using DPL in modules[edit source]

The more important thing to consider is using DPL in a module. There is no native method to access DPL within lua, so you will need to construct a string containing the DPL, then call frame:preprocess(...) on the string. That returns the wikicode result of that DPL. To make this easier you can use Module:DPLlua.

The primary benefit is that lua is significantly faster at formatting results than DPL, so should only do the minimum formatting in the DPL - you can save 30 seconds on a page load just by changing the formatting from a a normal DPL call using a surrogate template to lua calling and formatting the DPL. It also allows you to have finer-grain dynamic control over the DPL string, since you can write each line in response to the input to the module.

For more information on using lua and modules see the lua guide.

Other[edit source]

URL parameters[edit source]

Due to changes to how purging works in modern mediawiki, you can no longer use URL parameters to change the DPL - e.g. DPL_offset, DPL_limit, and using do not work. In order for the DPL to recognise the URL params, it has to be purged, but this removes the URL params since purging is now a POST request.

In order to have more dynamic/scrolling DPL on a page, you will need to use one of our calculator scripts (or write custom javascript for it), and have the DPL constructed via the script or a template/module.

plan[edit source]

basic

  • namespace, notnamespace
  • linksto, notlinksto
  • uses, notuses
  • imageused

page types

  • redirects
  • includesubpages

number

  • count

scrolling

  • offset
  • title>, title<

order

  • othermethod
  • order

advanced

  • category**
  • %match, %regexp (category, notcategory, title)
  • linksfrom
  • usedby
  • articlecategory

output

  • mode
  • inlinetext
  • secseparators
  • shownamespace

headers

  • resultsheader
  • resultsfooter
  • noresultsheader
  • noresultsfooter
  • oneresultsheader
  • oneresultsfooter

advnaced

  • include
  • table, tablerow
  • format



unreviewed additions[edit source]

DPL is a powerful tool that can create and manipulate lists of pages.

Basic syntax[edit source]

DPL can be written in 2 different formats: tag and parser.

Tag format uses <dpl> and writes each parameter on its own line:

<dpl>
parameter = foo
parameter2 = bar
</dpl>

Parser format uses {{#dpl:}} and uses pipe syntax for its parameters (which don't necessarily have to be on their own line):

{{#dpl:
|parameter = foo
|parameter2 = bar
}}

The core differences will decided which to choose, based on what you need it for:

Differences
Tag Parser
  • Cannot call template parameters directly ({{{1}}})
    • This can be worked around by using parameters to define variables with #var
  • Can use most characters without escaping
  • Cannot be substited
  • Newlines mark the end of the parameter
  • Can access template parameters directly
  • Requires pipes (|) to be escaped, and sometimes braces ({ and })
  • Can be substited; however, take care as to what is actually pasted with DPL (be sure to remove {{Extension DPL}})
  • Newlines can be used in parameters, but are not recommended

Basic functions[edit source]

Parameter Use Format Opposite
namespace Used to define which namespace(s) to search in. To reference the mainspace (ns:0), use an empty string. Use underscores (_) to separate words in multiword namespaces. literal notnamespace
title Used to match titles for your query literal N/A
titlematch LIKE nottitlematch
titleregexp regex nottitleregexp
category Used to look for categories articles should be in literal notcategory
categorymatch LIKE notcategorymatch
categoryregexp regex notcategoryregexp
ignorecase Tells all parameters whether or not to ignore case. Defaults to false. boolean N/A
redirects Tells the query to include redirects. By default, redirects are not included.
Use include to allow redirects.
Use only to look only at redirects.
ternary N/A
count Number of pages to look for at once. The max and default is 500. number N/A
offset Number of pages to skip before beginning search. Default is 0. number N/A

Format[edit source]

The format parameter is a powerful function that controls the output display of the query.

Syntax

Format is split into 4 parts, delimited by commas (,):

begin,result,suffix,end
  • begin dictates what is put before the entire query.
  • result dictates what is put for each result.
  • suffix dictates what is put after each result. In most cases, this would be the same as just putting the same text inside result; however, when using include, the suffix is where the content of tablerows appears (discussed below).
  • end dictates what is put at the end of the entire query.

The delimited sections are strict; i.e. result must always be after the first comma, etc. A part can be excluded by putting nothing between the commas.

Commas themselves cannot be used inside format. To use a comma, use its HTML reference: &#44;.

In addition, text can be added both before and after queries with different control:

  • resultsheader - Appears before formatted query. Will not appear if left blank.
  • oneresultheader - Appears before formatted query when only 1 result is found. Will default to the resultsheader if blank.
  • noresultsheader - Appears before formatted query when no result is found. Will default to an error message if blank.
  • resultsfooter - Appears after formatted query. Will not appear if left blank.
  • oneresultfooter - Appears after formatted query when only 1 result is found. Will default to the resultsfooter if blank.
  • noresultsfooter - Appears after formatted query when no result is found. Will default to nothing if blank.
  • suppresserrors - Prevents any error message from appearing.
Format variables

Certain information about each result can be included by calling the respective variable (%PARAM%). These only work in the result and suffix parts of the row.

  • %NR% - Result's position in list
  • %PAGENAME% - Pagename, including namespace
  • %NAMESPACE% - Page's namespace as a word
  • %TITLE% - Page title, no namespace; can be manipulated with replaceintitle

For the results header and footer sections:

  • %PAGES% - Count of pages listed currently
  • %TOTALPAGES% - Count of all pages found

Other variables exist, but require the use of more advanced functions, which will be discussed below.

Medium functions[edit source]

These functions are a bit more complex than the parameters listed above.

Parameter Use Format Opposite
linksfrom Finds articles which are linked directly from the page LIKE notlinksfrom
linksto Finds articles linking directly to the page LIKE notlinksto
imageused Finds pages using the image literal N/A
imagecontainer Finds images used on the specified article (all results will be "File:" namespace) literal N/A
uses Looks for articles transcluding the title. The "Template:" prefix is not implicit. literal notuses
usedby Looks for articles that are transcluded by the title. literal N/A
includesubpages Tells the result to include subpages of listed articles. Defaults to true.[med 1] boolean true or false
distinct Allows articles to be listed twice. Default is true. ternary N/A
categoriesminmax categoriesminmax = m,n


Articles that belong to at least m categories, but not more than n
Either m or n can be left blank
If blank, m is set to 0; n is set to infinity || number,number || style="text-align: center; ;" class="table-na" data-sort-value="0" | N/A

articlecategory Talk pages based on the categories of their subject's page literal N/A
skipthispage Allows DPL to include the page it is currently on to appear in the results


Defaults to true; setting to false will allow the page to appear || style="text-align: center; ;" class="table-na" data-sort-value="0" | N/A

Distinct[edit source]

When disctinct is set to true, articles can only be listed once, normally. With certain parameters, like linksfrom, it is possible for articles to be listed twice. To prevent articles from being listed twice under any circumstance, set distinct to strict. To allow articles to be listed twice under normal circumstances, set distinct to false

Format variables

These variables are available only when certain parameters are used:

  • %IMAGESEL% - With imageused, this gives the image that resulted in the match
  • %PAGESEL% - With linksto and linksfrom, this gives the page title that resulted in the match
  1. ^ This function is a bit more complex because it will find subpages that match the query up until the end, but not display them. This can cause apparent discrepencies. For example, if your query matches 600 pages, then DPL will find the first 500 pages. If 100 of those pages are subpages, they will simply be removed. This would leave you with 400 results, even if you specified 500.

Page info[edit source]

These parameters provide access to extra metadata about the article itself.

Parameter Variable Use
addpagesize %PAGESIZE% Size of page in bytes
addcategories %CATLIST% Categories, listed with pipes
%CATNAMES% Categories, listed with commas
%CATBULLETS% Categories, listed with <ul>

Advanced[edit source]

These functions are more powerful, and, as a result, are a bit more involved than previously listed parameters.

replaceintitle[edit source]

replaceintitle allows you to operate with regex on the title of the page. This function only affects %TITLE%.

replaceintitle = /pattern/,replacement

Here, pattern is a regular expression matched against the entire page title. It is invariably a global match; however, anchors can be used to force it to only operate once. In the example, / is used as the delimiter, but it is not the required delimiter. / was used because it is the most common standard, but any character can be used to delimit your pattern here. In fact, / is not recommended, because it appears in titles commonly. Characters such as #, [, or { are excellent choices for delimits because these will never appear in titles due to technical restrictions.

The replacement can be left blank to simply remove the matched strings, or it may be filled to define a replacement. If using capture groups, captures can be used with the appropriate reference ($n); however, the entire match cannot ($&).

include, includematch, includenotmatch, and tablerow[edit source]

These parameters can be used to directly read pages' contents and continue operations from there. They cannot edit articles; however, they can be used to restrict results based on what is actually in the page code.

Redirects cannot be included. Attempting to include a redirect will instead use the page it was redirected to.

include[edit source]

Include tells how much of an article to include.

  • * includes the entire page.
  • #section includes the section of the article that has the requested name
  • {template} includes all invocations of the requested template
    • {template}suffix can be used to place the paramets in a different template. If {{template}} does not exist, then DPL will use {{template.default}}, resulting in an error. If it does exist, then every parameter will be passed to {{templatesuffix}} for display.
    • {template¦alttemplate} can be used to request a fallback template. If {{template}} is not used, then DPL will use {{alttemplate}}.
    • suffix and ¦ may be combined. Only 1 altername template can be requested with each of suffix and ¦.
  • {template}:param includes the contents of the requested parameter in all invocations of the requested template
    • Multiple paramters can be requested by appending more :param#
    • For unnamed parameters, use the numerical value
    • Parameter requests can be combined with alternate template requests
  • Mutliple include queries can be used at once, by delimiting each request with a comma (,).
Examples

The quests involved for each quest item:

<dpl>
namespace = 
uses = Template:Infobox Item
category = Quest items
include = {Infobox Item}:quest
</dpl>

Trivia section of Nex:

<dpl>
namespace = 
title = Nex
include = #Trivia
</dpl>

Matching[edit source]

includematch and its opposite, includenotmatch, look at the content of all the material included and include or exclude pages based on the request. Matching is done after page listing; as such, it is possible, for example, for 500 pages to be found but only 400 listed.

These parameters use regex to operate. They require a delimiter, which may be any character. It is suggested to use a character which will not appear in your pattern to avoid extra character escaping. Unlike titles, these match operators cannot use interval quantifiers ({m,n}).

When matching templates, the entire template is looked at, even if only one parameter is specified. Patterns will need to take this into account.

Examples

Any rune described as a "basic elemental rune":

<dpl>
namespace = 
ignorecase = true
titlematch = %rune%
uses = Template:Infobox Item
include = {Infobox Item}:examine
includematch = /\|\s*examine\s*=\s*.+basic elemental rune/
</dpl>

Bosses that are less than 1,000 combat:

<dpl>
namespace = 
category = Bosses
uses = Template:Infobox Monster|Template:Infobox Monster new
include = {Infobox Monster¦Infobox Monster new}:combat
includenotmatch = /\|\s*level\s*=\s*[0-9][0-9]?,?[0-9][0-9][0-9]/
</dpl>

Formatting[edit source]

While not directly related to these parameters, tablerow dictates how the included output is formatted. It is important because while we may want to read an entire page or section, we do not always want to display what we read.

When using tablerow, each piece of information counts as a different "part". A template counts as one part, unless specific parameters are requested. For example:

This is 1 part:

include = {Infobox Item}

But this is 2 parts:

include = {Infobox Item}:value:examine

Each entity separated by a comma is also counted as a separate part or parts. Sections and such are counted as a single part, while templates contribute as described above.

Each part can be called in table row with the variable %%. These characters only call the respective part, with the part they represent being determined by which section of the row they are in. Other information can be included in these cells as well. Each cell is delimited by a comma (,).

For example, if we want all rune items that were released in June, but we want to display only their examine, we use:

<dpl>
namespace = 
uses = Template:Infobox Item
titlematch = %rune%
ignorecase = true
include = {Infobox Item}:release:examine
includematch = /\|\s*release\s*=\s*\[\[[0-9][0-9]? June\]\]/
tablerow = ,%%
format = ,\n* [[%PAGE%]]
</dpl>

It's also useful for searching entire sections for a text and only displaying which articles contain that text, without showing the sections themselves.

For example, if we wanted to see what monsters describe something as "strong" (anything, it doesn't have to be the monster itself), we can use:

<dpl>
namespace = 
uses = Template:Infobox Monster
include = *
includematch = /strong/
tablerow = &nbsp;
format = ,\n* [[%PAGE%]]
</dpl>

debug[edit source]

Debug can be used to diagnose problems with the query, but its best use is creating templates for pages. This can be done by setting the debug mode to 5. To work, debug must be the first parameter listed.

Example

Quick and inclusive disambiguation listing for "triangles":

<dpl>
debug = 5
namespace = 
titlematch = %triangle%
ignorecase = true
includesubpages = false
format = ,\n* [[%PAGE%]]
</dpl>

Page editing[edit source]

With any set of criteria, a nifty way to easily edit a large number of pages is using format to create a list of edit links.

A basic example:

format = ,\n* [[%PAGE]] -- [{{fullurl:%PAGE%|action=edit}} (edit)]

Or the ever-popular Mol-style:

format = \n{|style="margin-left:2%; border-left:20px solid #dedede; width:70%; outline-left:outset 9px #999; line-height:16px"\n|-,\n|-\n| [{{fullurl:%PAGE%|action=edit&summary=}} %PAGE%]<div style="border-bottom:dashed 1px #777;"></div>,,\n|}

This idea can be extended to other areas of editing, such as page moves:

For example, if User:Gaz Lloyd renamed himself to "Gaz L just L":

namespace = User|User_talk
titlematch = Gaz Lloyd%
replaceintitle = /^Gaz Lloyd/,Gaz L just L
format = ,\n* [{{fullurl:Special:MovePage/%PAGE%|wpNewTitleMain={{urlencode:%TITLE%}}}} Move %PAGE% to %TITLE%]
</dpl>

Index.php is actually a fairly robust editing tool, [https://www.mediawiki.org/wiki/Manual:Parameters_to_index.php fully documented here].

==Specific syntax==
===SQL like===
SQL like is used in most "match" parameters to compare strings. It is extremely basic in its patterns, but is often enough to match what is desired.

SQL like has 2 operators:

{|
| <code>%</code> || Matches any number of any character, including 0 characters
|-
| <code>_</code> || Matches any single character
|}

The operators can be used in any part of the pattern. When SQL like compares strings, your pattern represents the entire string. For example, to obtain any page title that begins with "bar", we would use:

<pre>
titlematch = Bar%

But to obtain any page that contains bar, we use:

titlematch = %bar%

Only the second pattern tells the query to also allow characters to be before the word "bar". It also covers the first pattern, because % is allowed to match 0 characters.

Operators can be combined as well. We can find a page that has a title containing both "bar" and "baz" with:

titlematch = %bar%baz%|%baz%bar%

Regular expressions[edit source]

Regular expressions are a more powerful pattern matching tool based on SQL REGEX. DPL's version, however, is slightly more limited. It is not recommended to use regexp parameters without some understanding of regular expressions in general. If you already understand regex, take note of the following differences:

  • The escape character is still \
  • Most parameters do not any delimiters. Those that do will indicate such in their section above.
    • When a delimiter is required, it may be any character. You are not restricted to /
    • As such, you can avoid requiring extra escaping by using a character you will not need as the delimiter
  • No character classes (e.g. \d); exception: \s can be used in certain parameters
  • No word boundaries (\b)
  • No look arounds
  • Backreferences cannot be used in patterns (\#)
  • Entire match is not available ($&)
  • Patterns are run as partial matches. The anchor characters (^ and $) operate as normal.
  • In titles, spaces are replaced with underscores _
  • Patterns are case-sensitive, unless using ignorecase
  • Interval quantifiers {m}, {m,n}, {m,} work for titles and categories, but not other matches

The following operators function as normal:

  • Dot .
  • Groups (...)
  • No capture groups (?:...)
  • Zero or more *
  • One or more +
  • Zero or one ?
  • Non-greedy quantifier *?, +?
  • Alteration |
  • Character classes [...], [^...]
  • Character class ranges [a-z]
  • Anchors ^, $

See also[edit source]

Want some more help?