Extension:DynamicPageList (Wikimedia)/zh


 * 此扩展是由Wikimedia使用，別與和混淆. 

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

起源
它最初是为了維基新聞开发的. 目前，维基新闻的大多数语言-{A|zh:项目;zh-hans:项目;zh-hant:專案;}-（詳见n:Wikinews:DynamicPageList）、Meta、MediaWiki.org 和其他一些小型项目都已有安装. 由于性能问题，它不会再安装到任何维基媒体的wiki上.

此扩展以前称为DynamicPageList/old，后来称为Intersection. 您可能还会对拥有更多功能的感兴趣.



配置
该扩展还支持几个配置变量. 通常情况下，你不会想更改默认值，但如果你想更改，可以在require_once行之后将它们添加到 "LocalSettings.php "中. 以下是支持的配置变量及其默认值：

使用
DynamicPageList 可在维基的编辑視窗中使用XML相似的语法. 参数控制了要列表的页面、顺序和显示模式. 有关各個参数的信息，请参阅以下章节. 例如，以下是本维基中最近移至 MediaWiki.org 的最古老的五个页面.

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

一个非常复杂的 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 

它列出了文件名空间中属于foo类别的第12页至第31页，将其格式化为图片库，并在标题中以年月日的格式标明添加到foo类别的日期、使其图片的宽度为70px



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

語法為

 category = Demo category = Demo 1 

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

 category   = Demo notcategory = Demo 1 

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

 category = Demo namespace = Help 

redirects
redirects決定是否包含重定向頁面. 该值可以是exclude（默认值，不列出重定向）、include（列出重定向）或only（不列出非重定向页面）.

 category = Demo redirects = only 

stablepages
stablepages决定了在使用时是否包含稳定（已标记）页面. 該值可以是 exclude（不列出）、include（列出稳定和非稳定页面. 是默认值）或only（只列出稳定页面）. 需要安装FlaggedRevs才能使用.

qualitypages
qualitypages决定了在使用时是否包含高质量（已标记為'纯净'等級）页面. 該值可以是exclude（不列出）、include（列出高质量和非高质量）或only（只列出高质量页面）.

注意：与旧版本相比，qualitypages 的行为有些变化. 在旧版本中，qualitypages=exclude 会自动设置为 stablepages=only. 现在已不再如此.

count
count限制顯示的結果數. 預設情況下會顯示最近添加到分類的頁面（請參閱排序）. 請注意，該擴展不會列出比擴展源代碼中所定義的最大值更多的結果.

 category = Demo count   = 2 

offset
offset能夠設定頁面項目列表的起始位置. 例如，可以用count制作多栏佈局.

 category = Demo offset   = 2 </DynamicPageList>

示例欄

<span id="Details_displayed">

shownamespace
shownamespace顯示命名空間在頁面名稱中. 此值可以是（預設，在名稱中顯示：）或（不在名稱中顯示：）.

 category     = Demo shownamespace = false </DynamicPageList>

addfirstcategorydate
addfirstcategorydate顯示每個頁面加入分類的日期. 此值可以是「true」（顯示日期）、「false」（預設，不顯示日期）或日期指示浮（ymd、md、dm、dmy、mdy或ISO 8601）. 如果指定了多個分類，則使用第一個分類. 在頁面名稱前方顯示的日期格式由您本地的MediaWiki日期格式偏好決定.

 category            = Demo addfirstcategorydate = true </DynamicPageList>

mode
mode指定列表格式，此值可以是：
 * unordered — 項目符號列表
 * ordered — 編號列表
 * none — 帶有換行的純連結
 * gallery — 圖庫，就像是
 * inline — 逗號分隔列表

unordered:  category = Demo mode    = unordered </DynamicPageList>

編號：

 category = Demo mode    = ordered </DynamicPageList>

純連結：

 category = Demo mode    = none </DynamicPageList>

逗號分隔：

 category = Demo mode    = inline </DynamicPageList>

mode=gallery
Gallery is a special mode where the output is an image gallery. If is installed, then the page-image if one exists will be used for non-file pages. Otherwise non-File namespace pages will just be a blank space.

 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 shownamespace=false </DynamicPageList>

suppresserrors
suppresserrors用以隱藏錯誤. 此值可以為「true」（隱藏錯誤）或「false」（預設，顯示錯誤）.

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

false:  category      = Dem 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/. 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      = Demo 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=&lt;id of article&gt; 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      = Demo googlehack      = true </DynamicPageList>

ordermethod
ordermethod指定排序及顯示日期，此值可以是：


 * categoryadd — 預設，以頁面加入第一個分類的日期排序
 * lastedit — 以頁面最後編輯時間排序
 * length — 以頁面長度排序
 * created — 以頁面建立時間排序
 * categorysortkey — 基本上按照第一個分類的排序字以字母順序排序
 * sortkey — categorysortkey的別名

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). 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            = Demo addfirstcategorydate = true ordermethod         = lastedit </DynamicPageList>

按字母順序範例：

 category            = Demo ordermethod         = sortkey </DynamicPageList>

order
order決定排序方向. The value can be descending (default, most recent to oldest) or ascending (oldest to most recent).

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

<span id="Derived_extensions">

衍生扩展

 * Derived extensions: outputs in forum style.  is like this but outputs an RSS feed.  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 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.
 * - makes dynamic page lists available to modules.