Trạng thái phát hành: ổn định | |
|---|---|
| Cài đặt | Tag,Parser function |
| Mô tả | Đưa ra một danh sách gạch đầu dòng các mục gần đây nhất của một hoặc nhiều danh mục. |
| Tác giả | IlyaHaykinson &Amgine |
| Phiên bản | Continuous updates |
| Compatibility policy | Snapshots releases along with MediaWiki.Master is not backward compatible. |
| MediaWiki | 1.23+ |
| PHP | 5.4+ |
| Database changes | Không |
| Giấy phép | GNU General Public License 2.0 or later |
| Tải xuống | |
| Ví dụ |
|
| |
<DynamicPageList> | |
| Translate the DynamicPageList extension | |
| Phản hồi | Open tasks ·Báo cáo lỗi |
Phần mở rộngDynamicPageList giúp người dùng wiki tạo ra danh sách các trang được liệt kê theo một tập hợp các danh mục. Xemm:Help:DPL để biết thông tin chung.
Ban đầu được phát triển choWikinews Nó hiện được cài đặt trên hầu hết các dự án Wikinews ngôn ngữ (xemn:Wikinews:DynamicPageList), Meta, MediaWiki.org và một vài dự án nhỏ khác.Itwill not be installed on any more Wikimedia wikis due to performance issues.
This extension was previously known asDynamicPageList/old and laterIntersection. You may also be interested inDynamicPageList3, which has more features.
intersection folder to yourextensions/ directory.cdextensions/gitclonehttps://gerrit.wikimedia.org/r/mediawiki/extensions/intersectionwfLoadExtension('intersection');
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 yourLocalSettings.php afterwfLoadExtension( 'intersection' ). Here is the supported configuration variables along with their default values:
# Configuration variables. Warning: These use DLP instead of DPL# for historical reasons (pretend Dynamic list of pages)$wgDLPmaxCategories=6;// Maximum number of categories to look for$wgDLPMaxResultCount=200;// Maximum number of results to allow$wgDLPAllowUnlimitedResults=false;// Allow unlimited results$wgDLPAllowUnlimitedCategories=false;// Allow unlimited categories// How long to cache pages using DPL's in seconds. Default to 1 day.// Set to false to use the normal amount of page caching (most efficient),// Set to 0 to disable cache altogether (inefficient, but results will never be outdated)$wgDLPMaxCacheTime=60*60*24;// How long to cache pages in seconds
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.
<DynamicPageList>category = Pages recently transferred from Metacount = 5order = ascendingaddfirstcategorydate = true</DynamicPageList>
An example of a really complex DynamicPageList:
<DynamicPageList>category=foocount=20namespace=file,mainaddfirstcategorydate=ymdimagewidth=70galleryshowfilesize=yesgalleryshowfilename=yesimagesperrow=7gallerycaption=Galleries!ordermethod=sortkeyorder=ascendingmode=galleryoffset=12</DynamicPageList>
Lists the 12th to the 31st 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 lists categories to intersect. DynamicPageList will list pages that are found inevery category listed. A minimum and maximum number of entries to list is set in the extension's source code. You may usemagic words like {{CURRENTMONTHNAME}} in the category name.
The syntax iscategory =category name
<DynamicPageList>category = Democategory = Demo 1</DynamicPageList>
notcategory restricts the list of pages to thosenot in a particular category. You can use magic words like {{CURRENTMONTHNAME}} in the category name.
<DynamicPageList>category = Demonotcategory = Demo 1</DynamicPageList>
namespace restricts the list of pages specified above to those in a particular namespace, specified by name or number (see theList of default namespaces). Any invalid name is equivalent to the main article namespace.
<DynamicPageList>category = Demonamespace = Help, user, main</DynamicPageList>
redirects determines whether or not to includeredirect pages.The value can be the following:
exclude -default, don't list redirectsinclude -list redirectsonly -don't list pages that aren't redirects<DynamicPageList>category = Demoredirects = only</DynamicPageList>
stablepages determines whether or not to include stable (flagged) pages when usingExtension:FlaggedRevisions.The value can be the following:
exclude -don't listinclude -list stable and non-stable.defaultonly -only list stable pagesRequires FlaggedRevs to be installed to work.
count restricts the number of results that are shown. By default, the pages added to the category most recently are shown (seeorder). Note that the extension will not list more results than the maximum defined in the extension source code.
<DynamicPageList>category = Democount = 2</DynamicPageList>
offset starts the list from somewhere other than the first page on the list.
For example, this can be used withcount to make multi-column layouts.
<DynamicPageList>category = Demooffset = 2</DynamicPageList>
Column demo
<table><tr><thcolspan="3"> recent articles in[[:category:Demo|:category:Demo]]</th></tr><tr><td><DynamicPageList>category = Democount=5</DynamicPageList></td><td><DynamicPageList>category = Demooffset = 5count= 5</DynamicPageList></td><td><DynamicPageList>category = Demooffset = 10count=5</DynamicPageList></td></tr></table>
shownamespace displays the namespace in the page names.The value can betrue (default, display in name:Help:Contents) orfalse (don't display in name:Contents).
<DynamicPageList>category = Demoshownamespace = false</DynamicPageList>
addfirstcategorydate shows the date each article was added to category. The value can betrue (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.
<DynamicPageList>category = Demoaddfirstcategorydate = true</DynamicPageList>
mode determines the format of the list.The value can be:
<gallery>unordered:<DynamicPageList>category = Demomode = unordered</DynamicPageList>ordered:<DynamicPageList>category = Demomode = ordered</DynamicPageList>none:<DynamicPageList>category = Demomode = none</DynamicPageList>inline:<DynamicPageList>category = Demomode = inline</DynamicPageList>
gallery is a special mode where the output is an image gallery.IfExtension:PageImages 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.
<DynamicPageList>category = Demomode = gallerynamespace= file</DynamicPageList>
gallery mode also supports the following options:
imagewidth -how wide the images should be in gallery, you may need to also setimageheight if using thisimageheight -how high the image should begalleryshowfilesize -show the image size, like on category pagesgalleryshowfilename -show filename like on category pagesimagesperrow -number of images per row in gallerygallerycaption -caption for galleryIf 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 {{CURRENTMONTHNAME}})
A complex gallery example might be:
<DynamicPageList>count=20namespace=fileaddfirstcategorydate=ymdimagewidth=70galleryshowfilesize=yesgalleryshowfilename=yesimagesperrow=7gallerycaption=Look at my pretty gallery.mode=galleryshownamespace=false</DynamicPageList>
suppresserrors hides errors. The value can betrue (hide errors) orfalse (default, show errors).
true:<DynamicPageList>category = Demsuppresserrors = true</DynamicPageList>false:<DynamicPageList>category = Demsuppresserrors = false</DynamicPageList>
nofollow setsrel="nofollow" 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.
<DynamicPageList>category = Demonofollow = true</DynamicPageList>
This is a hack for wikinews.Previously, Google News only considered articles with numbers in them to be news articles[1], so this appends?dpl_id=<id of article> 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.
<DynamicPageList>category = Demogooglehack = true</DynamicPageList>
ordermethod determines the order and date to display. The value can be:
categorysortkeyIt should be noted, thatlastedit 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—specifically,categoryadd andcategorysortkey fallback tocreated if there is nocategory clause.
<DynamicPageList>category = Demoaddfirstcategorydate = trueordermethod = lastedit</DynamicPageList>
alphabetical example:
<DynamicPageList>category = Demoordermethod = sortkey</DynamicPageList>
order decides the sort direction.The value can bedescending (default, most recent to oldest) orascending (oldest to most recent).
<DynamicPageList>category = Demoorder = ascending</DynamicPageList>
To use inside a template and pass parameters, use parser functions etc., use the{{#tag: function:
{{#tag:DynamicPageList|category={{{1}}}count ={{#if:{{{2|}}}| 10| 20}}ordermethod = sortkeyorder = ascending}}
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<includeonly> tags. Example:
Lỗi: Cần phải bao gồm ít nhất một thể loại hay định rõ một không gian tên!
| This extension is being used on one or moreWikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia'sCommonSettings.php andInitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki'sSpecial:Version page. |
| This extension is included in the following wiki farms/hosts and/or packages: |