Help:DynamicPageList

Contents

DPL (also known as the Dynamic Page List extension) is a powerful MediaWiki extension that allows for the creation of lists of pages using various criteria such as membership in a category or inclusion of a specific template.

DPL is most commonly used for displaying simple lists of pages in a set of categories -- i.e., pages in Category:Episodes AND Category:Stubs.

Because of its great power, DPL increases server load and can result in significantly slower page loads for wikias that use it. As such, it is strongly encouraged you read the Using DPL effectively section of this article.

Benefits of DPL

DPL is very effective because a little bit of code can produce a long and detailed list of information that would take a long time to construct manually.

Creates dynamic listings of pages based on various parameters, such as page titles, namespaces, membership in a category, template inclusion, and more.

For example you can create a page that lists all pages in two categories but not in a third.

Can include page information such as date of last edit, username of last editor, and more.

Can display lists in tables, bulleted or numbered lists, in category-page style, or inline.

How to include DPL on a page

DPL queries start with the <dpl> tag and close with the </dpl> tag. Within these tags, users may put a wide variety of parameters
to customize and tailor the query to their needs. You can also use {{#dpl: .... }} instead.

Here is a very basic DPL query example:

<DPL>
category=Characters
</DPL>

This query above would output a list of all the pages that are in the category Characters.

This query would display all pages that are in the Character namespace and have the category Characters if the page also did not have the category Season 1 Characters. This list would also be printed as a <ol> as opposed to the default <ul>.

A comprehensive list of all DPL parameters is available here, and further information about the extension can be found on MediaWiki.org.

Using DPL effectively

DPL can cause heavy server loads, slowing the entire site down. The following are tips on how to get around the problem.

First, Consider whether your DPL usage is necessary. If it's only used because it's "cool" you might be able to provide something equally cool to your users in the same space, such as a poll, calendar, embedded RSS feed, embedded video, and more.

Secondly, if you decide DPL is the best tool for the job, let DPL cache results! Simply add this line to your DPL query:

allowcachedresults=true

Use other tools for common DPL uses

Creating simple category lists

For creating simple category lists you might use the <categorytree> tag (documentation). For instance, to get a list of pages in the category 'Community' consider the following:

For more advanced uses, please check that a more specialized extension is not available before using DPL. For example, instead of creating a calendar with DPL use one of the calendar extensions available. If you are unsure or don't see an extension you need, contact us and we'll be happy to help.

Things to avoid

Do not use DPL for:

Functions using "randomcount" - they can't be cached

DPL in templates that are used site-wide - creates hidden DPL calls all over the wikia

Large queries - don't display 500 results if 20 will do the job

More than one or two queries per page

Common problem workarounds

If you see strange output from DPL, try putting ?action=purge (or &action=purge, if ? is already used) at the end of your URL and reload the URL.

This can fix problems where DPL backend code was updated, but the server cache was not refreshed.