Template:DPL from category

From FrathWiki
Revision as of 06:53, 1 July 2009 by Melroch (talk | contribs)
Jump to navigationJump to search


Usage

  {{DPL from category 
  | category=somecategory
  | heading=listheading
  | namespace=some-namespace-other-than-main
  | columns=number-of-columns
  | exclude category=excluded-category 0
  | exclude category <digit>=excluded-category 1-9
  }}

  OR

  {{DPL from category 
  | somecategory 
  | listheading
  | some-namespace-other-than-main
  | number-of-columns
  | excluded-category 0
  | excluded-category 1
  | excluded-category <digit>
  | excluded-category 9
  }}

  e.g.

  {{DPL from category 
  | category=Conlangs
  | heading=Conlangs on FrathWiki listed alphabetically
  | namespace=
  | columns=3
  | exclude category=Meta-pages
  | exclude category 1=Theory
  | exclude category 2=Concultures
  }}

Named parameters can come in any order. Unnamed parameters must be in the order shown; to skip one of them leave a blank between two pipes.

All parameters except category/the first unnamed parameter are optional!

Parameters

category
the category whose member pages should be listed
heading
the (level two) heading to go above the table. Leave a blank value for a list with no heading.
namespace
the namespace listed pages should belong to. The default is Main.
columns
the number of columns in the output table. The default is 2.
exclude category [digit]
name categories which should be excluded from the list.

Due to a limitation in DPL category exclusion doesn't allow the use of pipes  |  to list more than one category in one parameter value. Instead several calls to the same parameter are necessary. To allow for some flexibility I've made it possible to use up to ten category exclusions with this template, which should be more than enough. excluded category <digit> means that you may use named parameters excluded category 1, excluded category 2, excluded category 3 and so on up to excluded category 9, or up to ten unnamed parameters with names of categories to exclude as values after the number-of-columns parameter.

What this template does

This template calls the Dynamic Page List extension to generate a list of the pages in a given category and its subcategories.

To get your page on such a list include it into the relevant category or one of its subcategories. Practically it means putting the text [[Category:category-name]] (where category-name should be replaced by the name of any of the relevant category or one of its subcategories, which you will find listed if you type "Category:category-name" in the wiki search box and hit enter. Traditionally such category tags go in a group at the bottom or top of the page, so that they can easily be found and edited, but nothing will be broken if you (accidentally) put them somewhere else or add something before or after them. There is no need to include your page both in the top category and one or more of its subcategories, and it will be listed here only once even if you do (and there may be a good reason to do so: your page may be a legitimate member of e.g. all of Category:Conlangs, Category:Conlangs by 3.135.189.25 and Category:Indo-European conlangs!)

Why a dynamically generated list is preferable

There are several reasons why a dynamically generated list is preferable to a manually generated list:

  • You need to edit only in one place, the page you want listed. (Unless you assign it a hitherto non-existing category in which case you will need to add that category as a subcategory of the top category referenced by the dynamic list or one of its existing subcategories, for which see below.)
  • You should anyway assign your page to the appropriate category or categories, so that people with a general rather than particular idea of what they are looking for can find it. The dynamic list creates an extra road to your page in one fell swoop!
  • If you should change the name of/move the listed page (or ask a sysop to do it for you), or add/remove/change your page's subcategory the dynamic list will be automatically updated.
  • The list will be automatically alphabetized. (Unfortunately not ignoring punctuation for the time being!)

Your own subcategory

You can easily create your own category (e.g. Category:Conlangs by 3.135.189.25) just by putting a category tag [[Category:your-category]] on your page. If you think it should be included in a list created with this template just go to the page Category:your-category (where of course "your-category" should be replaced by the actual name of your category; please don't actually edit Category:your-category!) by clicking on the category link at the bottom of your page, or type "Category:your-category" in the wiki search box and hit enter, then add [[Category:top-category]], where of course "top-category" should be replaced by the actual category name referenced by the dynamic list you want your subcategory to go into!) to the text of the category page of the subcategory to be.