WordPress 中文文档

DynamicPageList

From WordPress Chinese

Jump to: navigation, search

对应中文条目:MediaWiki扩展:动态页面列表

This page in other languages:


DynamicPageList is a Mediawiki 1.5 extension developed for use on Wikinews, but 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

The dynamic page list is in CVS at wikipedia/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 has to match the defined parameters.

The following lists parameters and their effects

category

Purpose:

Include a category in the union of directories. For example, if you include a category parameter, any page being linked to from the output of the DPL has to be in that given category. If more than one category is listed, the pages listed have to be 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 magic words like {{CURRENTMONTHNAME}}, {{CURRENTDAY}}, {{CURRENTYEAR}} etc in the category name.

notcategory

Purpose:

Much like the category parameter, but requires that every page listed not be 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:

To restrict the articles in the list to only be from one 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]].


shownamespace

Purpose:

To restrict the appearance of the namespace name of a page before the page. For example, when this parameter is used, instead of Template:Stub the listing would simply be Stub.

Example:

shownamespace=false

If omitted, the default is true.

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.

mode

Purpose:

To control the output of the DPL.

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.

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.

count

Purpose:

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

ordermethod

Purpose:

Determines what date is used for ordering the list.

Example:

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
</DynamicPageList>

This list will output pages that have [[Category:Africa]] showing most recently edited articles at the top.

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.

redirects

Purpose:

Controls the inclusion or exlusion 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]].

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=Africa
addfirstcategorydate=true
</DynamicPageList>

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

对应中文条目:MediaWiki扩展:动态页面列表

原文网址:http://meta.wikimedia.org/wiki/DynamicPageList

用户