Extension:NiceCategoryList3/es
![]() Estado de la versión: estable |
|
---|---|
![]() |
|
Implementación | Etiqueta |
Descripción | Displays a nicely-formatted category list, with versatile sub-category listing. |
Autor(es) | |
Última versión | 1.1.2 (2024-06-12) |
MediaWiki | 1.39.0+ |
PHP | 7.3+ |
Licencia | Licencia Pública General de GNU 2.0 o posterior |
Descargar | github release v1.1.2 GitHub: Nota: |
Ejemplo | see below |
|
|
<ncl> |
|
The NiceCategoryList3 extension displays a category listing, including sub-categories, in a number of useful formats.
This is intended to allow easier navigation of a wiki's category tree.
It implements a new tag, <ncl>
, which generates a list of all pages and sub-categories in a given category.
The list can display multiple levels of sub-categories, and has several options for the display style.
This extension was originally created by Kichik as Extension:NiceCategoryList , was enhanced by JohanTheGhost and *Surak* and Crafty Coding. This was updated to work for recent version of MediaWiki by JLTRY.
This extension has not been tested on wikis with large (more than a hundred or so) category trees. It may be unacceptably slow on very large wikis. Use with care. |
Usage
Parameters
The <ncl>
tag displays a category list:
<ncl [options]>Category:Some Category</ncl>
The tag takes the following parameters, all of which are optional:
Parameter | Description | Default |
---|---|---|
maxdepth=<number> | maximum category depth to display | 32 |
headings=<style> | head to display category headings as Wiki headings; bullet to display category headings as bullet lists
|
head |
showfirst=<bool> | 0 to skip top heading, else display it
|
0 |
headstart=<number> | with headings=head , headstart is the heading level to list top-level categories with
|
2 |
style=<style> | bullet para mostrar los contenidos de las categorías como listas de bala; "compacto" para una lista más compacta
|
bullet |
showcats=<bool> | not 0 to display sub-category links in "bottom" (i.e. maxdepth) categories
|
0 |
showarts=<bool> | not 0 to display articles in categories
|
1 |
sort=<bool> | not 0 to sort the list alphabetically; else sort the list according to the index key
|
0 |
number=<number> | not 0 to display only up to <number> of articles, else display all articles
|
0 |
random=<bool> | with number not 0 : display random choice of articles if random not 0 , else display the first number of articles
|
0 |
CSS Styles
The original wiki syntax created with version 2.2 was basically left, but all direct formatting was taken out.
En su lugar, los elementos discretos están incluidos en las etiquetas <div>
y <span>
con nombres de clases.
The benefit is that you can apply styles to the items, either in Common.css, in the current skin's CSS or in your user CSS.
<!-- Sample output for
<ncl headings=head headstart=2 style=bullet>category</ncl>
-->
<div class="ncl-nicecategorylist>
<div class="ncl-block ncl-block-head ncl-block-head-0">
<h2 class="ncl-heading ncl-heading-0">
Category Name
</h2>
<div class="ncl-content ncl-content-bullet ncl-content-bullet-0">
<ul>
<li><span class="ncl-subcategory">Subcategory Link</span></li>
<li><span class="ncl-subcategory">Subcategory Link</span></li>
<li> ‴ </li>
<li><span class="ncl-article">Article Link</span></li>
<li><span class="ncl-article">Article Link</span></li>
<li> ‴ </li>
</ul>
</div>
</div>
‴
</div>
<!-- Sample output for
<ncl headings=bullet style=compact>category</ncl>
-->
<div class="ncl-nicecategorylist>
<div class="ncl-block ncl-block-bullet ncl-block-bullet-0">
<div class="ncl-heading ncl-heading-0">
<ul><li>Category Link</li></ul>
</div>
<div class="ncl-content ncl-content-compact ncl-content-compact-0">
<p>
<span class="ncl-subcategory">Subcategory Link</span> •
<span class="ncl-subcategory">Subcategory Link</span> •
‴ •
<span class="ncl-article">Article Link</span> •
<span class="ncl-article">Article Link</span> •
‴ •
…
</p>
</div>
</div>
‴
</div>
The whole category tree is now encapsulated into a <div>
container with a classname of ncl-nicecategorylist
.
Each level of the category tree is encapsulated in a div container with a classname of ncl-block-{headings}-{x}
.
{headings} means one of the headings
options, either bullet
or head
.
{x} means a numeric value that starts at zero and is increased on each subordinate level of the category list, until maxdepth
is reached.
Inside of this top <div>
container, two subordinate blocks exist for the heading and the content:
- The heading is covered by a block with a classname of
ncl-heading-{x}
. {x} means a numeric value that starts at zero and is increased on each subordinate level of the category list, untilmaxdepth
is reached. If the optionshowfirst=0
, then the first header is not displayed. This is the default setting, since previous versions of the extension did not display it. The default can be overwritten by using$egNiceCategoryListShowFirst = 1;
inLocalSettings.php
.- If the option
heading=bullet
, the block is a<div>
block displaying the category as link to the category page as bullet list item. - If the option
heading=head
, the block is a usual headings block, starting at<h{n}>
. {n} means a numeric value that starts at {headstart} and is increased on each subordinate level of the category list. The default setting isheadstart=2
. It can be set back to the default of previous versions by using$egNiceCategoryListHeadStart = 1;
inLocalSettings.php
. If you want to activate the first heading for a certain category list, you can use the optionshowfirst=1
(or inactivate it withshowfirst=0
otherwise).
- If the option
- The content is covered by a block with a classname of
ncl-content-{style}-{x}
. {style} means one of thestyle
options, eitherbullet
orcompact
. {x} means a numeric value that starts at zero and is increased on each subordinate level of the category list, untilmaxdepth
is reached. Tiene contenedores de<span>
con las subcategorías (sishowcats=1
) y artículos (sishowarts=1
) de la categoría de referencia.- Each subcategory is enclosed in a
<span>
container with a classname ofncl-subcategory
. - Each article is enclosed in a
<span>
container with a classname ofncl-article
.
- Each subcategory is enclosed in a
Additionally to the above mentioned classes, some generic classes are defined to apply styles on groups of items:
ncl-block
to apply styles to all items with classnames ofncl-block-bullet-{x}
andncl-block-head-{x}
.ncl-block-bullet
to apply styles to all items with classnames ofncl-block-bullet-{x}
.ncl-block-head
to apply styles to all items with classnames ofncl-block-head-{x}
.ncl-heading
to apply styles to all items with classnames ofncl-heading-{x}
.ncl-content-compact
to apply styles to all items with classnames ofncl-content-bullet-{x}
andncl-content-compact-{x}
.ncl-content-bullet
to apply styles to all items with classnames ofncl-content-bullet-{x}
.ncl-content-compact
to apply styles to all items with classnames ofncl-content-compact-{x}
.
Examples
For a full, recursive listing of all categories under a specified category, use this: <ncl>Category:Some Category</ncl>
|
|
For a nice "high-level" category index, use this in a template: <ncl style=compact maxdepth=2 headings=bullet headstart=2
showcats=1 showarts=1>Category:{{PAGENAME}}</ncl>
|
|
This: <ncl style=compact headings=bullet headstart=2 showcats=1
showarts=0>Category:Categories</ncl>
|
Caveat: When used in a template, the category list will not refresh immediately when reloaded; edit and save the article to see updates.
Installation
- download the last version from GitHub y extrae los archivos en el directorio «
NiceCategoryList3
» dentro del directorioextensions/
existente. - Añade el siguiente código en la parte final de tu archivo LocalSettings.php :
wfLoadExtension( 'NiceCategoryList3' );
- Configure at your convenience.
Hecho – Navega a Special:Version en el wiki para verificar que la extensión se haya instalado correctamente.
Configuration
If you want to inactivate the cache for pages using the extension, use:
$egNiceCategoryListDisableCache = true; // disables page caching
If you want to default the headstart
option to something different than 2
, use:
$egNiceCategoryListHeadstart = 1; // defaults headstart to 1
If you want to default the display of the first heading, use:
$egNiceCategoryListShowFirst = 1; // displays first heading
Version history
Version 1.1.1 | |