DynamicPageList

From Meta, a Wikimedia project coordination wiki
This is an archived version of this page, as edited by Patrick (talk | contribs) at 08:52, 15 August 2006 (Compare [http://meta.wikimedia.org/w/index.php?title=Special:Recentchangeslinked&target=Category:Demo&hideminor=0&days=3000&limit=1000 related changes] , which shows the same order, but gives ''all''). It may differ significantly from the current version.

This page in other languages:


DynamicPageList is a Mediawiki 1.5 extension developed for use on Wikinews (see n:Wikinews:DynamicPageList and e.g. [1]), but can be installed on any wiki. It works also on Meta. It allows wiki users to create a list of pages that are listed in a set of categories. An enhanced version of the extension is described at DynamicPageList2

The dynamic page list is in SVN at mediawiki/trunk/extensions/intersection/DynamicPageList.php. To install it, put the file in your extensions/ directory, and add include("extensions/DynamicPageList.php"); to your LocalSettings.php file.

Using DynamicPageList

The Dynamic Page List (DPL) is a MediaWiki extension. To use it, use the following XML-like syntax on your wiki page:

<DynamicPageList>
...parameters...
</DynamicPageList>

The output of this would be something like:

where the list of pages being output, as well as the order and display mode of the list are set by the parameters specified.

The following lists parameters and their effects

Page selection

category

Purpose:

DPL produces a list of all pages in the intersection of the specified categories (the pages which are in all of the listed categories).

Syntax:

category=category name

Example:

<DynamicPageList>
category=Demo
category=Demo 1
</DynamicPageList>

gives

No pages meet these criteria.

This list will output pages that are in both Category:Demo and Category:Demo 1.

Notes:

At least one category parameter is required. There is a maximum number of category parameters allowed by the extension, configurable at installation time (see top of the extension file). You may use magic words like {{CURRENTMONTHNAME}}, {{CURRENTDAY}}, {{CURRENTYEAR}} etc in the category name.

notcategory

Purpose:

Restricts the list of pages specified above to those not in a particular category.

Syntax:

notcategory=category name

Example:

<DynamicPageList>
category=Demo
notcategory=Demo 1
</DynamicPageList>

gives


(list of pages that are in Category:Demo but not in Category:Demo 1).

Notes: You may use magic words like {{CURRENTMONTHNAME}}, {{CURRENTDAY}}, {{CURRENTYEAR}} etc in the category name.

namespace

Purpose:

Restricts the list of pages specified above to those in a particular namespace.

Syntax:

namespace=namespaceid or name

The namespaceid may be any positive integer or zero, assuming it represents a valid namespace in the system. The zero namespace is the main article namespace.

Instead of the number, you may also specify a name, for example Talk or Template or User_talk. Any invalid name is equivalent to the main article namespace.

Example:

<DynamicPageList>
category=Demo
namespace=Help
</DynamicPageList>

gives

No pages meet these criteria.

(list of pages that are in the Help namespace and belong to Category:Demo).

redirects

Purpose:

Controls the inclusion or exclusion of redirect pages in lists.

Format:

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:

Example:

<DynamicPageList>
category=Demo
redirects=only
</DynamicPageList>

gives

No pages meet these criteria.

(list of redirect pages in Category:Demo).

count

Purpose:

Restricts the number of results that are shown.

Format:

count=number of results

Example:

<DynamicPageList>
category=Demo
count=2
</DynamicPageList>

gives


(list of the two most recent pages in Category:Demo).

Notes:

There is a maximum allowed number of results, controlled by a setting in the extension.

Details displayed

shownamespace

Purpose:

Specify whether to display the namespace names of the pages (default=true).

Example:

<DynamicPageList>
category=Demo
shownamespace=false
</DynamicPageList>

gives


addfirstcategorydate

Purpose:

Shows the date the article got added to the first listed include category. The linked page names are prepended with "DD Month YYYY: " (formatted according to your local mediawiki date display preferences).

Example:

addfirstcategorydate=true

If omitted, the default is false.

Example:

<DynamicPageList>
category=Demo
addfirstcategorydate=true
</DynamicPageList>

gives


mode

Purpose:

To control the output of the DPL: with bullets, numbers, or nothing in front.

Syntax:

mode=modename

modename can be one of:

  • unordered — outputs an unordered list — HTML tag "ul" — (default)
  • ordered — outputs an ordered list — HTML tag "ol"
  • none — outputs a list using newlines and HTML tags "br" to separate each item

Examples:

<DynamicPageList>
category=Demo
mode=ordered
</DynamicPageList>

gives

  1. Template:H:lf


<DynamicPageList>
category=Demo
mode=none
</DynamicPageList>

gives


Template:H:lf


suppresserrors

Purpose:

Allows warnings about empty lists to be suppressed.

Format:

suppresserrors=true

(default is false).

<DynamicPageList>
category=Dem
suppresserrors=true
</DynamicPageList>

gives


Compare:

<DynamicPageList>
category=Dem
</DynamicPageList>

gives

No pages meet these criteria.

Order

ordermethod

Purpose:

Determines what date is used for ordering the list.

Format:

ordermethod=method

method can be one of:

  • categoryadd — outputs list based on most recent addition to the first category — (default)
  • lastedit — outputs list based on most recent edit to the pages

Example:

<DynamicPageList>
category=Demo
ordermethod=lastedit
</DynamicPageList>

gives


Example:

<DynamicPageList>
category=Africa
ordermethod=lastedit
</DynamicPageList>

(shows most recently edited pages at the top).

Compare related changes , which shows the same order, but gives all edits instead of only the last, but, on the other hand, currently on this project restricted to edits of the last month.

order

Purpose:

Controls the sort direction of the list.

Example:

order=orderdirection

orderdirection can be one of:

  • descending — outputs list from most recent to least recent — (default)
  • ascending — outputs list from least recent to most recent

Example:

<DynamicPageList>
category=Africa
order=ascending
</DynamicPageList>

This list will output pages that have [[Category:Africa]] shown ordered from oldest to newest.