Examples/Parameter: title (example 2): Difference between revisions
imported>FrozenPlum m forgot to preview |
imported>FrozenPlum m FrozenPlum moved page Criteria for page selection/Parameter: title (example 2) to Examples/Parameter: title (example 2): Simplifying how things are structured |
||
(One intermediate revision by the same user not shown) | |||
Line 6: | Line 6: | ||
==Example== |
==Example== |
||
This will select the [[Apple]] article, which uses [[Template:Color]] on its page more than once. The <code>{{DPL|include}}</code> statement both includes all parameters available in [[Template:Color]], '''and''' it passes their values to a surrogate template, [[Template:Color.templatevalues]] for formatting. The use of <code>{{DPL|title}}</code> is unique, it implicitly sets <code>mode=userformat</code>, which allows additional control over the output, and allows <code>{{DPL|secseparators}}</code> to be used. The first argument of <code>secseparators</code> sets nothing <code>,</code> to be displayed before each result, then its second argument sets a line break <code>\n</code> and four hyphens <code>----</code> (which create a horizontal rule/line). Another line break <code>\n</code> puts each result below that line. Without the <code>secseparators</code> statement, each result would appear side by side instead. |
|||
This example will take all invocations of template "Color" in article '''[[Apple]]''' and will include and apply "Template:Color.templatevalues". The output will be separated, at the top of each page, by horizontal lines. |
|||
<pre> |
<pre> |
||
Line 12: | Line 12: | ||
|title=Apple |
|title=Apple |
||
|include={Color}.templatevalues |
|include={Color}.templatevalues |
||
⚫ | |||
|mode = userformat |
|||
⚫ | |||
}} |
}} |
||
</pre> |
</pre> |
||
Line 22: | Line 21: | ||
|title=Apple |
|title=Apple |
||
|include={Color}.templatevalues |
|include={Color}.templatevalues |
||
⚫ | |||
|mode = userformat |
|||
⚫ | |||
}} |
}} |
||
<noinclude> |
<noinclude> |
||
[[Category:Select by title-related criteria]] |
[[Category:Select by title-related criteria]] |
Latest revision as of 22:46, 31 March 2023
Example
This will select the Apple article, which uses Template:Color on its page more than once. The include
statement both includes all parameters available in Template:Color, and it passes their values to a surrogate template, Template:Color.templatevalues for formatting. The use of title
is unique, it implicitly sets mode=userformat
, which allows additional control over the output, and allows secseparators
to be used. The first argument of secseparators
sets nothing ,
to be displayed before each result, then its second argument sets a line break \n
and four hyphens ----
(which create a horizontal rule/line). Another line break \n
puts each result below that line. Without the secseparators
statement, each result would appear side by side instead.
{{#dpl: |title=Apple |include={Color}.templatevalues |secseparators=,\n----\n }}
Result
{{#dpl: |title=Apple |include={Color}.templatevalues |secseparators=,\n----\n }}