(format test)
(23 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
{{#dpl:execandexit=geturlargs}}
 
{{#dpl:execandexit=geturlargs}}
 
{{#dpl:
 
{{#dpl:
| allowcachedresults = no
+
| allowcachedresults = false
| execandexit = {{#if:{{#dplvar:cat1}}||please specify a category via <code>&cat1=</code> in the URL!}}
+
| execandexit = {{#if:{{#dplvar:cat1}}||please specify a category via <code>&cat1=</code> in the URL!<br />²{/doc}²}}
| execandexit = {{#if:{{#dplvar:cat2}}||please specify a category via <code>&cat2=</code> in the URL!}}
+
| execandexit = {{#if:{{#dplvar:cat2}}||please specify a category via <code>&cat2=</code> in the URL!<br />²{/doc}²}}
| resultsheader = «large»Pages in [[:Category:{{#dplvar:cat1}}]] AND [[:Category:{{#dplvar:cat2}}]]«/large»«hr /»The following %TOTALPAGES% pages are in both categories.
+
| resultsheader = <span style="font-size: 120%;">²{#replace:Pages in [[:Category:{{#dplvar:cat1}}¦{{#dplvar:cat1}}]] AND [[:Category:{{#dplvar:cat2}}¦{{#dplvar:cat2}}]]¦_¦&#32;}²</span><hr />The following %TOTALPAGES% page²{#ifeq: %TOTALPAGES% ¦1¦&nbsp;is¦s are in both categories.
| noresultsheader = «large»Pages in [[:Category:{{#dplvar:cat1}}]] AND [[:Category:{{#dplvar:cat2}}]]: none«/large»«hr /»
+
| noresultsheader = <span style="font-size: 120%;">Pages in ²{#replace:[[:Category:{{#dplvar:cat1}}¦{{#dplvar:cat1}}]] AND [[:Category:{{#dplvar:cat2}}¦{{#dplvar:cat2}}]]¦_¦&#32;}²: none</span><hr />
| count = {{#dplvar:count}}
 
 
| category = {{#dplvar:cat1}}&{{#dplvar:cat2}}
 
| category = {{#dplvar:cat1}}&{{#dplvar:cat2}}
  +
| redirects = include
 
| mode = category
 
| mode = category
| ordermethod = title
+
| ordermethod = sortkey
 
}}
 
}}

Revision as of 11:57, 18 July 2018

please specify a category via &cat2= in the URL!

Description

This is a DPL (Dynamic Page List) template that finds the intersection of two categories. It is intended to replace some redundant categories with a logical AND of two other categories. The output is alphabetical by page name and is formatted like a category page. Redirect pages are included in the results.

Cache Problem

At some point after creation of this template, it stopped working correctly. It would either claim that you were missing one of the arguments, or it would ignore your inputs and return the results from the last time it was called. My hypothesis is that Wikia changed the rules governing caching of pages and possibly broke the allowcachedresults = false feature of DPL. See my bug report here. A workaround for this problem is to append &action=purge to the end of the URL. This seems to force a cache clear and return the correct results. I have updated the examples below to use this workaround.

Usage

There are two arguments, DPL_cat1= and DPL_cat2=, that are passed through the URL so that this template may be used in multiple places. In the URL, the first argument after the page name must be delineated with a question mark, "?", otherwise the whole argument string is interpreted as part of the name and the wiki complains the page does not exist. The second argument and any others are delineated by an ampersand "&". The Magic Word {{fullurl:page name|query_string}} can be used to create the URL and will insert the question mark before the query_string for you. Note that spaces in the query_string must be replaced by underscore characters.

For example, a link that gives all Gems that are Magic items would be constructed with:

[{{fullurl:Template:Category intersection|DPL_cat1=Gems&DPL_cat2=Magic_items&action=purge}} Example link 1]

Example link 1

Other examples: Wizards of Cormyr and Great red wyrms

Community content is available under CC-BY-SA unless otherwise noted.