Extensión:DynamicPageList
Estado de la versión: estable |
|
|---|---|
| Implementación | Etiqueta, Función del analizador |
| Descripción | Outputs a bulleted list of most recent items residing in a category, or an intersection of several categories. |
| Autor(es) | IlyaHaykinson and Amgine |
| Última versión | Continuous updates |
| Política de compatibilidad | Se publican nuevas instantáneas junto con MediaWiki. La rama maestra no es retrocompatible. |
| MediaWiki | 1.23+ |
| PHP | 5.4+ |
| Cambios en la base de datos | No |
| Licencia | Licencia Pública General de GNU 2.0 o posterior |
| Descargar | |
| Ejemplo |
|
|
|
<DynamicPageList> |
|
| Traduce la extensión DynamicPageList | |
| Incidentes | Tareas abiertas · Reportar un error |
La extensión DynamicPageList permite a los usuarios de wikis crear una lista de páginas que están listadas en un set de categorías.
Origen
It was originally developed for Wikinews. It is currently installed on most language Wikinews projects (see n:Wikinews:DynamicPageList), Meta, MediaWiki.org, and a few other small projects. It will not be installed on any more Wikimedia wikis due to performance issues.
This extension was previously known as DynamicPageList/old and later Intersection. You may also be interested in DynamicPageList3, which has more features.
Instalación y configuración
Instalación
- Descarga y mueve la carpeta
intersectionextraída a tu directorioextensions/.
Los desarrolladores y contribuidores de código deberían instalar la extensión desde Git en su lugar, usando:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/intersection
- Añade el siguiente código en la parte final de tu archivo LocalSettings.php:
wfLoadExtension( 'intersection' );
Hecho – Navega a Special:Version en el wiki para verificar que la extensión se haya instalado correctamente.
Configuración
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 wfLoadExtension( '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
Uso
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 Meta
count = 5
order = ascending
addfirstcategorydate = true
</DynamicPageList>
An example of a really complex DynamicPageList:
<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
</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
Page selection
category
category lists categories to intersect. DynamicPageList will list pages that are found in every category listed. A minimum and maximum number of entries to list is set in the extension's source code. You may use magic words like {{CURRENTMONTHNAME}} in the category name.
The syntax is category = category name
<DynamicPageList>
category = Demo
category = Demo 1
</DynamicPageList>
notcategory
notcategory restricts the list of pages to those not in a particular category. You can use magic words like {{CURRENTMONTHNAME}} in the category name.
<DynamicPageList>
category = Demo
notcategory = Demo 1
</DynamicPageList>
namespace
namespace restricts the list of pages specified above to those in a particular namespace, specified by name or number (see the List of default namespaces). Any invalid name is equivalent to the main article namespace.
<DynamicPageList>
category = Demo
namespace = Help
</DynamicPageList>
redirects
redirects determines whether or not to include redirect pages. The value can be exclude (default, don't list redirects), include (list redirects), or only (don't list pages that aren't redirects).
<DynamicPageList>
category = Demo
redirects = only
</DynamicPageList>
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.
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.
<DynamicPageList>
category = Demo
count = 2
</DynamicPageList>
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.
<DynamicPageList>
category = Demo
offset = 2
</DynamicPageList>
Column demo
<table>
<tr><th colspan="3"> recent articles in [[:category:Demo|:category:Demo]]</th></tr>
<tr><td>
<DynamicPageList>
category = Demo
count=5
</DynamicPageList>
</td>
<td>
<DynamicPageList>
category = Demo
offset = 5
count= 5
</DynamicPageList>
</td>
<td>
<DynamicPageList>
category = Demo
offset = 10
count=5
</DynamicPageList>
</td></tr></table>
Detalles mostrados
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).
<DynamicPageList>
category = Demo
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.
<DynamicPageList>
category = Demo
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
<gallery> - inline – comma separated list
unordered:
<DynamicPageList>
category = Demo
mode = unordered
</DynamicPageList>
ordered:
<DynamicPageList>
category = Demo
mode = ordered
</DynamicPageList>
plain links:
<DynamicPageList>
category = Demo
mode = none
</DynamicPageList>
inline:
<DynamicPageList>
category = Demo
mode = inline
</DynamicPageList>
mode=gallery
Gallery is a special mode where the output is an image gallery. If Extension: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 = 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 {{CURRENTMONTHNAME}})
A complex gallery example might be:
<DynamicPageList>
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 hides errors. The value can be true (hide errors) or false (default, show errors).
true:
<DynamicPageList>
category = Dem
suppresserrors = true
</DynamicPageList>
false:
<DynamicPageList>
category = Dem
suppresserrors = false
</DynamicPageList>
nofollow
nofollow sets rel="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 = 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 [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 = Demo
googlehack = true
</DynamicPageList>
Order
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 — por longitud de artículo
- created — by article creation date
- categorysortkey — essentially alphabetical order by the sort key of the first category
- sortkey — alias de 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—specifically, categoryadd and categorysortkey fallback to created if there is no category clause.
<DynamicPageList>
category = Demo
addfirstcategorydate = true
ordermethod = lastedit
</DynamicPageList>
ejemplo alfabético:
<DynamicPageList>
category = Demo
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).
<DynamicPageList>
category = Demo
order = ascending
</DynamicPageList>
Plantillas
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 = sortkey
order = 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:
Error: debes incluir al menos una categoría, o especificar un espacio de nombres
Extensiones derivadas
- Derived extensions: DPLforum outputs in forum style. Extension:GoogleNewsSitemap is like this but outputs an RSS feed. DynamicPageList3 is a modified version with more features, but also more resource-expensive. No se utiliza en los sitios de Wikimedia.
- Extension:DynamicPageListEngine - makes dynamic page lists available to Scribunto modules.
| Esta extensión está siendo usada en uno o más proyectos de Wikimedia. Esto significa probablemente que la extensión es estable y funciona lo suficientemente bien como para ser usada en sitios con gran cantidad de visitas. Puedes buscar el nombre de esta extensión en los archivos CommonSettings.php e InitialiseSettings.php de Wikimedia para ver dónde se instala. Encontrarás la lista completa de extensiones instaladas en un wiki en particular en la página Special:Version del wiki. |
| Esta extensión está incluida en los siguientes anfitriones/granjas wiki y/o paquetes: No se trata de una lista oficial. Algunas granjas/hosts wiki y/o paquetes pueden tener disponible esta extensión aunque no estén listados aquí. Siempre compruébelo con su anfitrión o granja wiki para confirmarlo. |
- Stable extensions/es
- Tag extensions/es
- Parser function extensions/es
- GPL licensed extensions/es
- Extensions in Wikimedia version control/es
- ParserFirstCallInit extensions/es
- All extensions/es
- Extensions used on Wikimedia/es
- Extensions included in Miraheze/es
- Extensions included in WikiForge/es
- Page content extensions/es
- Category intersection extensions/es
