User:Faltout/SandBox/DPL category attribute sum

Usage
Sums numbers collected from pages in categories using DPL


 * category is a list of categories to select pages from, separated with the character.
 * andcategory is an optional list of categories that the pages selected should also be part of. Separated with the character.
 * notcategory is an optional list of categories that the selected pages should not belong to, separated with the character.
 * template is the name of the template used in the selected pages with the template's namespace. For example, " "
 * attribute is the name of the attribute that should be selected from the template.
 * num_template is the name of the template that can translate the output of template or attribute or phantom to a numerical value.
 * phantom is the name of a phantom template that will take the original parameters of the template and output a different result.

Notes: category and template are mandatory. However, for the sum to work, the final output should be a numerical value. Initially, we have the result of template. If this is not what we want, we can either take an attribute passed to it, or designate a phantom template to create a different result. If this is still not what we want, we can provide a num_template to translate the output of attribute or phantom to a numerical value.

Examples
Give category template and attribute to sum the specific attribute/parameter of a template from all the pages in one category.

Example:

You can also count attributes that are not numbers by providing a template in num_template that will convert text to number.

Example:

You can use a phantom template to produce numbers based on more complex calculations that involve more than one of the initial template parameters. The phantom template provided in the parameter phantom should have a number as a result. The parameter attribute does not have an effect if phantom is given.

Example:

Use notcategory to prevent pages from being in a certain category.

Example:

Use andcategory to make pages belong to more categories.

Example: