Anonymous edits have been disabled on the wiki. If you want to contribute please login or create an account.

Difference between revisions of "Template:Categorybox"

From PCGamingWiki, the wiki about fixing PC games
m (changed parameter two a bit)
(updated to use Extension:DynamicPageList (Wikimedia) instead)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
<includeonly><table class="pcgwikitable template-categorybox">
 
<includeonly><table class="pcgwikitable template-categorybox">
<caption class="template-categorybox-title">[[:Category:{{{1}}}|{{#if: {{{2|}}}|{{{2}}}|{{{1}}}}}]]</caption>
+
<caption class="template-categorybox-title">[[:Category:{{{1}}}|{{#if: {{{2|}}}|{{{2}}}|{{{1}}}}}]]</caption><!--
{{#ifeq: {{{2|}}} | subcategoriesonly | {{#ask:[[Subcategory of::{{{1}}}]]|format=template|template=Categorybox/row|columns=1|}} | {{#ask:[[Category:{{{1}}}]]|format=template|template=Categorybox/row|columns=1|}} }}
+
 
 +
LEGACY CODE START
 +
 
 +
{{#ifeq: {{{3|}}} | subcategoriesonly | {{#ask:[[Subcategory of::{{{1}}}]]|limit=100|format=template|template=Categorybox/row|columns=1|}} | {{#ask:[[Category:{{{1}}}]]|format=template|template=Categorybox/row|columns=1|}} }}
 +
 
 +
LEGACY CODE STOP
 +
 
 +
The <tr class="template-categorybox-row"><td class="template-categorybox-cell"></td></tr>
 +
below came initially from Categorybox/row
 +
 
 +
--><tr class="template-categorybox-row">
 +
<td class="template-categorybox-cell">{{#tag:DynamicPageList|
 +
category            = {{{1|}}}
 +
order                = ascending
 +
ordermethod          = sortkey
 +
namespace            = {{#ifeq: {{{3|}}} | subcategoriesonly | category }}
 +
shownamespace        = false
 +
mode                = none
 +
}}</td>
 +
</tr>
 
</table></includeonly><noinclude>{{Documentation}}</noinclude>
 
</table></includeonly><noinclude>{{Documentation}}</noinclude>

Latest revision as of 21:31, 18 October 2021

Documentation for the above template (sometimes hidden from view).

This is an automated template in the likes of {{Seriesbox}} that creates a floating list of member pages of a category.

Real-world examples

  • The Category:Graphics API have one defined, which is then transcluded unto the various member pages through transclusion using {{:Category:Graphics API}}.

Related templates

Syntax

{{Categorybox|Category Name|Custom Title}}

Parameters

  1. Name of the category to query
  2. Custom title of the sidebar (the category name will be used if left blank).
    • Note that the custom title will still automatically link to the category page.
  3. Custom options, of any of the following:
    • subcategoriesonly - Limits the query to only fetch the actual subcategories defined below a main category. This is used to circumvent the behavior of Semantic MediaWiki of returning pages in subcategories as if they belonged in the parent category itself.

Usage

  • {{Categorybox|Graphics API}} creates the right-aligned sidebar here below, by querying Category:Graphics API.
Graphics API

List of Direct3D 10 games
List of Direct3D 11 games
List of Direct3D 12 games
List of DirectDraw games
List of Direct3D 2-7 games
List of Direct3D 8 games
List of Direct3D 9 games
List of Direct3D 9Ex games
List of Glide games
List of Mantle games
List of Metal games
List of OpenGL games
List of Vulkan games
List of WinG games


  • {{Categorybox|Games in pre-alpha state|Example #2}} adding a second parameter will set that text as a custom title.
Pre-Alpha state
No pages meet these criteria.