Jump to content

DynamicPageList: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
m Reverted changes by WhatAWonderfullWorld (talk) to last version by Tegel
Tag: Rollback
 
(22 intermediate revisions by 14 users not shown)
Line 1: Line 1:
{{MovedToMediaWiki|Extension:DynamicPageList (Wikimedia)}}
This page in other languages:
* German translation of this page: [[DynamicPageList (de)]]
----
'''DynamicPageList''' is a Mediawiki 1.5 extension developed for, and installed on all versions of [[n:en:Main Page|Wikinews]] (see [[n:Wikinews:DynamicPageList]] and e.g. [http://en.wikinews.org/w/index.php?title=Wikinews:2006/August/10&action=edit]), and has also been installed on Meta. It can be installed on any wiki. 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]]'''. Another version, installed on Wikia, is '''[[DPLforum]]'''. See also [[Help:DPL]].

The dynamic page list is in SVN at [http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/intersection/DynamicPageList.php mediawiki/trunk/extensions/intersection/DynamicPageList.php].
To install it, put the file in your <code>extensions/</code> directory, and add <code>include("extensions/DynamicPageList.php"); </code> to your LocalSettings.php file.

==Using DynamicPageList==

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

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

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:

<code>category=<i>category name</i></code>

Example:

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

gives

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

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 <nowiki>{{CURRENTMONTHNAME}}, {{CURRENTDAY}}, {{CURRENTYEAR}}</nowiki> etc in the category name.

===notcategory===

Purpose:

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

Syntax:

<code>notcategory=<i>category name</i></code>

Example:

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

gives

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

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

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

===namespace===

Purpose:

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

Syntax:

<code>namespace=<i>namespaceid or name</i></code>

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:

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

gives

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

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


===linksto===

Purpose:

Restricts the list of pages to those which contain a reference to a specific page.

Syntax:

<code>linksto=<i>pagename</i></code>

Example:

<pre>
<DynamicPageList>
debug=1
category=Demo
linksto=MyWiki:About MyWiki
mode=inline
inlinetext=<br/>
ordermethod=title
</DynamicPageList>
</pre>

This gives an alphabetic list of all articles which belong to category "Demo" and link to page "About_MyWiki" (which resides in namespace #2). It can be useful to set "debug=1" to avoid error messages in case there is no article which satisfies all the constraints.

Note that ''pagename'' can also be something like <nowiki>{{FULLPAGENAME}}</nowiki>. This gives you a generic way to produce a list of pages which link to the current page AND belong to a certain category. This generic form could also be used within a template. So you are able to construct a system of templates which insert inverted links with a semantic connotation into your documents.

Example:

You describe a city and use a template called "Template:Artists_in_this_city". The template uses DPL2 to produce a list of articles which belong to the category ''artist'' (or to a sub-category of ''artist'', like ''painter'' or ''poet'') and which refer to the current city.

===redirects===

Purpose:

Controls the inclusion or exclusion of redirect pages in lists.

Format:

<code>redirects=<i>criteria</i></code>

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

Example:

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

gives

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

(list of redirect pages in [[:Category:Demo]]).

===count===

Purpose:

Restricts the number of results that are shown.

Format:

<code>count=<i>number of results</i></code>

Example:

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

gives

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

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

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

gives

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

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

<code>addfirstcategorydate=true</code>

If omitted, the default is ''false''.

Example:

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

gives

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

===mode===

Purpose:

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

Syntax:

<code>mode=<i>modename</i></code>

''modename'' can be one of:
* ''unordered'' &mdash; outputs an unordered list &mdash; HTML tag "ul" &mdash; '''(default)'''
* ''ordered'' &mdash; outputs an ordered list &mdash; HTML tag "ol"
* ''none'' &mdash; outputs a list using newlines and HTML tags "br" to separate each item

Examples:

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

gives

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

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

gives

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

===suppresserrors===

Purpose:

Allows warnings about empty lists to be suppressed.

Format:

<code>suppresserrors=true</code>

(default is ''false'').

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

gives

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

Compare:
<pre>
<DynamicPageList>
category=Dem
</DynamicPageList>
</pre>

gives

<DynamicPageList>
category=Dem
</DynamicPageList>

==Order==
===ordermethod===

Purpose:

Determines what date is used for ordering the list.

Format:

<code>ordermethod=<i>method</i></code>

''method'' can be one of:
* ''categoryadd'' &mdash; outputs list based on most recent addition to the first category &mdash; '''(default)'''
* ''lastedit'' &mdash; outputs list based on most recent edit to the pages

Example:

<pre>
<DynamicPageList>
category=Demo
addfirstcategorydate=true
ordermethod=lastedit
</DynamicPageList>
</pre>

gives

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

(shows most recently edited pages at the top).

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'' edits instead of only the last, but, on the other hand, currently on this project restricted to edits of the last month. It also gives other info for each entry.

===order===

Purpose:

Controls the sort direction of the list.

Example:

<code>order=<i>orderdirection</i></code>

''orderdirection'' can be one of:
* ''descending'' &mdash; outputs list from most recent to least recent &mdash; '''(default)'''
* ''ascending'' &mdash; outputs list from least recent to most recent

Example:

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

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


[[Category:MediaWiki extensions]]

Latest revision as of 20:09, 16 October 2019