Extension:DynamicPageList (Wikimedia)/zh


 * 此擴展被Wikimedia使用，不要和DynamicPageList (third-party)擴展或Extension:DynamicPageList3混淆.

DynamicPageList擴展讓Wiki用戶建立頁面列表來列出一組分類中的頁面. 有關一般信息請見m:幫助:DPL.

Origin
It was originally developed for Wikinews. It is currently installed on all language Wikinews projects (see n:Wikinews:DynamicPageList), Meta, Wikibooks, and Wikiversity and can be installed on any small to medium sized Wikis (It is known to have scalability issues with very large wikis).

This extension was previously known as DynamicPageList/old and later Intersection. You may also be interested in the third-party DynamicPageList, which has more features.

配置
The extension also supports a couple of configuration variables. Normally you wouldn't want to change the default, but if you do you can add them to your "LocalSettings.php" after the require_once line. Here is the supported configuration variables along with their default values:

使用
DynamicPageList can be used with XML-like syntax in the wiki edit view. The parameters control the pages to list, order, and display mode. See the following sections for information on each parameter. For example, the following are the oldest five pages on this wiki that were recently moved to MediaWiki.org.

 category            = Pages recently transferred from Meta count               = 5 order               = ascending addfirstcategorydate = true 

An example of a really complex DynamicPageList:  category=foo count=20 namespace=file addfirstcategorydate=ymd imagewidth=70 galleryshowfilesize=yes galleryshowfilename=yes imagesperrow=7 gallerycaption=Galleries! ordermethod=sortkey order=ascending mode=gallery offset=12 

Lists the 12th to the 34th pages in the file namespace that are also in category foo, formatting them into an image gallery, with the date they were added to category foo in the caption in year month day format, and having the images have a width of 70px

category
category列出要交集的分類. DynamicPageList將會列出在所有分類都能找到的頁面，要列出的最小和最大頁面數在擴展源代碼中被設定，你可以在分類名稱中使用魔術字，例如 August.

語法為

 category = 示範 category = 示範1 

notcategory
notcategory可以限制頁面列表不在特定分類中，你可以在分類名稱中使用魔術字，例如 August.

 category   = 示範 notcategory = 示範1 

namespace
namespace將上面指定的頁面列表限制在特定命名空間中，使用名稱或編號指定（請參閱預設命名空間列表）. 任何無效名稱將等效於主條目命名空間.

 category = 示範 namespace = Help 

redirects
redirects指定是否包含重定向頁面. 值可以是「exclude」（預設，不列出重定向）、「include」（列出重定向）、「only」（不列出非重定向頁面）.

 category = 示範 redirects = only 

stablepages
stablepages determines whether or not to include stable (flagged) pages when using Extension:FlaggedRevisions. The value can be exclude (don't list), include (list stable and non-stable. default), or only (only list stable pages). Requires FlaggedRevs to be installed to work.

qualitypages
qualitypages determines whether or not to include quality (flagged at the 'pristine' level) pages when using Extension:FlaggedRevisions. The value can be exclude (don't list), include (list both quality and non-quality), or only (only list quality pages).

Note: the behaviour of qualitypages changed from older versions. In older versions qualitypages=exclude automatically made stablepages=only be set. This is no longer the case.

count
count restricts the number of results that are shown. By default, the pages added to the category most recently are shown (see order). Note that the extension will not list more results than the maximum defined in the extension source code.

 category = 示範 count   = 2 

offset
offset starts the list from somewhere other than the first page on the list. For example, this can be used with count to make multi-column layouts.

 category = 示範 offset   = 2 

欄示例

shownamespace
shownamespace displays the namespace in the page names. The value can be true (default, display in name: Help:Contents) or false (don't display in name: Contents).

 category     = 示範 shownamespace = false </DynamicPageList>

addfirstcategorydate
addfirstcategorydate shows the date each article was added to category. The value can be true (display date), false (default, don't display date), or a date specifier (ymd, md, dm, dmy, mdy, and ISO 8601). If many categories are specified, it uses the first category. The linked page names are prepended with the date formatted according to your local MediaWiki date display preferences.

 category            = 示範 addfirstcategorydate = true </DynamicPageList>

mode
mode determines the format of the list. The value can be:
 * unordered — bulleted list
 * ordered — numbered list
 * none — plain links with line breaks
 * gallery — image gallery, like &lt;gallery&gt;
 * inline — comma separated list

未排序：  category = 示範 mode    = unordered </DynamicPageList>

排序：  category = 示範 mode    = ordered </DynamicPageList>

普通連結：  category = 示範 mode    = none </DynamicPageList>

單行：  category = 示範 mode    = inline </DynamicPageList>

mode=gallery
Gallery is a special mode where the output is an image gallery. When using this mode, you would usually want to restrict the namespace to file.  category = Demo mode    = gallery namespace= file </DynamicPageList> Gallery mode also supports the options imagewidth (how wide the images should be in gallery, you may need to also set imageheight if using this), imageheight (how high the image should be) galleryshowfilesize (show the image size, like on category pages), galleryshowfilename (show filename like on category pages), imagesperrow (number of images per row in gallery), gallerycaption (caption for gallery).

If addfirstcategorydate is in use, the date is appended to the caption of the image.

Note, gallerycaption at the moment cannot accept links. (but it can accept things like August )

A complex gallery example might be:  count=20 namespace=file addfirstcategorydate=ymd imagewidth=70 galleryshowfilesize=yes galleryshowfilename=yes imagesperrow=7 gallerycaption=Look at my pretty gallery. mode=gallery </DynamicPageList>

suppresserrors
suppresserrors hides errors. The value can be true (hide errors) or false (default, show errors).

true:  category      = 示範 suppresserrors = true </DynamicPageList>

false:  category      = 示範 suppresserrors = false </DynamicPageList>

nofollow
nofollow sets  on the links. This prevents spiders from getting to the page through the link from the DynamicPageList. In general this is useless, as spiders will either be able to index the page from other links, or not at all due to robots.txt/$wgDefaultRobotPolicy. In general you should not use this option unless you know what you are doing, and have a good reason. The primary usecase is that on the English Wikinews, Google News considers anything linked from the main page to be an article.

 category      = 示範 nofollow      = true </DynamicPageList>

googlehack
This is a hack for wikinews. Previously, Google News only considered articles with numbers in them to be news articles, so this appends ?dpl_id= to the end of the urls on the list. You shouldn't use this option unless you have a good reason to (however it won't hurt anything). This replaces the showcurid option that is no longer supported.

 category      = 示範 googlehack      = true </DynamicPageList>

ordermethod
ordermethod determines the order and date to display. The value can be:
 * categoryadd — default, sort by date pages were categorised for first category
 * lastedit — sort by date pages were last edited
 * length — by article length
 * created — by article creation date
 * categorysortkey — essentially alphabetical order by the sort key of the first category
 * sortkey — alias of categorysortkey
 * popularity — by number of hits

It should be noted, that lastedit really sorts by the last time the page was touched. In some cases this is not equivalent to the last edit (for example, this includes permission changes, creation or deletion of linked pages, and alteration of contained templates). popularity is only enabled on wikis that have $wgDisableCounters set to. As such it will not work on Wikimedia wikis. If you do not specify a category, some of these order methods will not work&mdash;specifically, categoryadd and categorysortkey fallback to created if there is no  clause.

 category            = 示範 addfirstcategorydate = true ordermethod         = lastedit </DynamicPageList>

alphabetical example:

 category            = 示範 ordermethod         = sortkey </DynamicPageList>

order
order decides the sort direction. The value can be descending (default, most recent to oldest) or ascending (oldest to most recent).

 category = 示範 order    = ascending </DynamicPageList>

模板
To use inside a template and pass parameters, use parser functions etc., use the  function:

The template page itself will display an error message because the category value is empty on the template page unless you put the template inside  tags. Example:

Derived extensions

 * Derived extensions: DPLforum outputs in forum style. Extension:GoogleNewsSitemap is like this but outputs an RSS feed. Extension:DynamicPageList (third-party) is a modified version with more features, but also more resource-expensive. Neither of the latter is used on Wikimedia's sites.
 * Version 1.8.4 of DynamicPageList (third-party) is fully downward compatible with the extension described here. So the way is open for a re-unification of the different development paths. This is not true any more for the current versions since version 2.01 of DynamicPageList (third-party) does not support.
 * Extension:DynamicPageListEngine makes dynamic page lists available to Scribunto modules.
 * Extension:Multi-Category Search provides similar functions.