Jump to content

Wikinews:DynamicPageList

From Wikinews, the free news source you can write!

DynamicPageList (DPL) is a Mediawiki extension developed for use on Wikinews (see e.g. Wikinews:2006/August/14), but can be installed on any wiki. Its name was officially changed to the Intersection extension to avoid confusion with a similar but different DynamicPageList extension. However, it is still generally referred to as DynamicPageList. It works also on Meta, Wikibooks, and several other wikimedia wikis (not wikipedia). It allows wiki users to create a list of pages that are listed in a set of categories. An enhanced versions of the extension has been developed, mw:Extension:DynamicPageList (third-party), but it is not yet available on Wikinews, and is unlikely to be any time soon (however it is super-awesome!).

The dynamic page list is in Git at [1]. To install it, put the file in your extensions/ directory, and add wfLoadExtension("intersection") to your LocalSettings.php file.

Using DynamicPageList

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

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

The output of this would be something like:

  • [[Page 1]]
  • [[Page 2]]
  • ...

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=Africa
category=Politics and conflicts
</DynamicPageList>

This list will output pages that have both the [[Category:Africa]] and [[Category:Politics and conflicts]] listed.

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 any magic word (variable) like {{CURRENTMONTHNAME}}, {{CURRENTDAY}}, {{CURRENTYEAR}}, {{PAGENAME}} etc in the category names. You can even use templates if you wish. Even templates with parameters. (For example, see Portal:Random). However, if you want to make a transcludable DPL with parameters (aka category={{{1}}}), you must use {{#tag:... syntax.

notcategory

Purpose:

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

Syntax:

notcategory=category name

Example:

<DynamicPageList>
category=Africa
notcategory=Zimbabwe
</DynamicPageList>

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

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=Policy
namespace=Wikinews
</DynamicPageList>

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

redirects

Purpose:

Controls the inclusion or exclusion of redirect pages in lists.

Example:

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:

<DynamicPageList>
category=Africa
redirects=include
</DynamicPageList>

This list will content pages and redirect pages tagged with [[Category:Africa]].

count

Purpose:

Restricts the number of results that are shown.

Example:

count=number of results

Example:

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

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

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

With the code

shownamespace=false

instead of e.g. Template:Stub the listing would simply be Stub.

Example:

<DynamicPageList>
category=Africa
namespace=Talk
shownamespace=false
</DynamicPageList>

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

addfirstcategorydate

Purpose:

Shows the date the article got added to the first listed include category.

Example:

addfirstcategorydate=true

If omitted, the default is false.

Example:

<DynamicPageList>
category=Kenya
category=Tanzania
addfirstcategorydate=true
</DynamicPageList>

gives:

(apparently the lower bound is 2 July 2005)

This list will output a list of pages belonging to [[Category:Africa]], prepending each result with "DD Month YYYY: " (formatted according to your local mediawiki date display preferences).

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

Example:

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

This list will output pages that have [[Category:Africa]] shown in an <ol>...</ol> list.

suppresserrors

Purpose:

Allows warnings about empty lists to be suppressed.

Example:

suppresserrors=true

If omitted, the default is false.

Example:

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

This list will output no pages since the category is non-existent, but will not show a warning saying the list is empty.

Error messages are controllable via:

Originally this parameter was used very heavily throughout Wikinews, as the error message for no articles was very cryptic and ugly. Now we have changed the error message to be more friendly, so the use of this paramter is not as important anymore. Nonetheless, it is still commonly used.

showcurid

Purpose:

Link includes unique page id (needed for some web spiders, links directly to a page even if it moved titles, or the title specified is incorrect [2]). This is specifically used by the google news spider, which needs a unique identifier for each page in the url. This does not change appearance, just the link url.

Example:

showcurid=true

If omitted, the default is false.

Example:

<DynamicPageList>
category=Published
showcurid=true
</DynamicPageList>

Example:

If Post-probe, problematic peanut paste products pulled was on the page list. Without the parameter, it would link to http://en.wikinews.org/wiki/Post-probe,_problematic_peanut_paste_products_pulled . However, with the parameter it links to http://en.wikinews.org/wiki/Post-probe,_problematic_peanut_paste_products_pulled?curid=120194 .

googlehack

Like curid, except uses the parameter dpl_id instead of curid. Curid sometimes triggers the no robots flag.

googlehack=true

FlaggedRevisions

Purpose to control inclusion of pages marked sighted/stable/quality

stablepages

stablepages=filter

filter can be:

  • exclude — excludes stable pages from lists — (default if invalid argument given)
  • include — allows stable pages to appear in lists (default)
  • only — lists only stable pages in lists

qualitypages

qualitypages=filter

filter can be:

  • exclude — excludes quality pages from lists — (default if invalid argument given)
  • include — allows quality pages to appear in lists (default)
  • only — lists only quality pages in lists

Order

ordermethod

Purpose:

Determines what date is used for ordering the list.

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=Africa
ordermethod=lastedit
addfirstcategorydate=true
count=3
</DynamicPageList>

gives

Note that sorting order is by last edit (or, in the case of a category, apparently by last edit of a page in that category), with most recently edited pages at the top, while the display date is that of addition to the category Africa.

whereas

<DynamicPageList>
category=Africa
ordermethod=addcategory
addfirstcategorydate=true
count=3
</DynamicPageList>

gives


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.

See also

Note
stuff below is not installed here (but is interesting)