Examples/Parameter: title (example 2): Difference between revisions

From DynamicPageList3 Manual
Content added Content deleted
imported>FrozenPlum
(Created page with "<noinclude>{{note|Please '''do not edit''' this page unless you're wanting to edit the manual itself, it is an example included in the manual.|error}}</noinclude><!-- This is the example preloaded for testing, press "Show Preview" to see the example working (at the bottom of the page). If you save this page, it saves as a new section at the bottom of your '''User:Username/Sandbox''' --> ==Example== This example will take all invocations of template "Color" in article '...")
 
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)
 
(3 intermediate revisions 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". The output will be separated, at the top of each page, by horizontal lines.


<pre>
<pre>
{{#dpl:
{{#dpl:
|title=Apple
|title=Apple
|include={Color}
|include={Color}.templatevalues
|secseparators=,\n----\n
|mode = userformat
|secseparators=\n----\n
}}
}}
</pre>
</pre>
Line 21: Line 20:
{{#dpl:
{{#dpl:
|title=Apple
|title=Apple
|include={Color}
|include={Color}.templatevalues
|secseparators=,\n----\n
|mode = userformat
|secseparators=\n----\n
}}
}}

<noinclude>
<noinclude>
[[Category:Select by title-related criteria]]
[[Category:Select by title-related criteria]]
Line 32: Line 29:
[[Category:Uses mode parameter]]
[[Category:Uses mode parameter]]
[[Category:Uses secseparators parameter]]
[[Category:Uses secseparators parameter]]
[[Category:Uses a surrogate template]]
</noinclude>
</noinclude>

Latest revision as of 22:46, 31 March 2023

Please do not edit this page unless you're wanting to edit the manual itself, it is an example included in the manual.

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 }}