Template:DPL from category: Difference between revisions
(Recreating template with better syntax) |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
{{#if: {{{heading|{{{2|}}}}}} | == {{{heading|{{{2|List of pages in [[:Category:{{{category|{{{1|}}}}}}]]}}}}}} == }} | {{#if: {{{heading|{{{2|}}}}}} | =={{{heading|{{{2|List of pages in [[:Category:{{{category|{{{1|}}}}}}]]}}}}}}== }} | ||
<span style="font-size:small;">This list is dynamically generated. Please don't try to edit it directly/manually, but see [[Template:DPL from category|here]] for how to get your page included.</span> | |||
{{#DPL: | {{#DPL: | ||
Line 10: | Line 11: | ||
| namespace={{{namespace|{{{3|}}}}}} | | namespace={{{namespace|{{{3|}}}}}} | ||
| columns={{{columns|{{{4|2}}}}}} | | columns={{{columns|{{{4|2}}}}}} | ||
| notcategory={{{notcategory|{{{exclude category|{{{5|}}}}}}}}} | | notcategory={{{exclude category|{{{5|}}}}}} | ||
| {{{ | | notcategory={{{exclude category 1|{{{6|}}}}}} | ||
| notcategory={{{exclude category 2|{{{7|}}}}}} | |||
| notcategory={{{exclude category 3|{{{8|}}}}}} | |||
| notcategory={{{exclude category 4|{{{9|}}}}}} | |||
| notcategory={{{exclude category 5|{{{10|}}}}}} | |||
| notcategory={{{exclude category 6|{{{11|}}}}}} | |||
| notcategory={{{exclude category 7|{{{12|}}}}}} | |||
| notcategory={{{exclude category 8|{{{13|}}}}}} | |||
| notcategory={{{exclude category 9|{{{14|}}}}}} | |||
}}</includeonly><noinclude> | }}</includeonly><noinclude> | ||
Line 22: | Line 31: | ||
| namespace=some-namespace-other-than-main | | namespace=some-namespace-other-than-main | ||
| columns=number-of-columns | | columns=number-of-columns | ||
| | | exclude category=excluded-category 0 | ||
| exclude category <digit>=excluded-category 1-9 | |||
}} | }} | ||
Line 30: | Line 40: | ||
| somecategory | | somecategory | ||
| listheading | | listheading | ||
| some-namespace-other-than-main | | some-namespace-other-than-main | ||
| number-of-columns | | 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 | |||
}} | }} | ||
</nowiki></pre></code> | </nowiki></pre></code> | ||
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. | 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 === | === Parameters === | ||
; category: the category whose member pages should be listed | ; 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. | ; heading: the (level two) heading to go above the table. Leave a blank value for a list with no heading. Include extra equals signs in the parameter text to get lower-level headings! | ||
; namespace: the namespace listed pages should belong to. The default is Main. | ; 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. | ; 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 <code> | </code> 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. <code>excluded category <digit></code> means that you may use named parameters <code>excluded category 1, excluded category 2, excluded category 3</code> and so on up to <code>excluded category 9</code>, or up to ten unnamed parameters with names of categories to exclude as values after the ''number-of-columns'' parameter. | |||
== What this template does == | == What this template does == | ||
Line 64: | Line 93: | ||
You can easily create your own category (e.g. [[:Category:Conlangs by {{CURRENTUSER}}]]) just by putting a category tag <code><nowiki>[[Category:your-category]]</nowiki></code> 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 <code><nowiki>[[Category:top-category]]</nowiki></code>, 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. | You can easily create your own category (e.g. [[:Category:Conlangs by {{CURRENTUSER}}]]) just by putting a category tag <code><nowiki>[[Category:your-category]]</nowiki></code> 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 <code><nowiki>[[Category:top-category]]</nowiki></code>, 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. | ||
</noinclude> | </noinclude> |
Latest revision as of 06:58, 1 July 2009
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. Include extra equals signs in the parameter text to get lower-level headings!
- 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.149.232.87 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.149.232.87) 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.