Examples/Parameter: include (example 6): 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 selects the Examples page, and includes parser functio...")
 
imported>FrozenPlum
m (Found (I hope) a way to simplify the description of what this is doing to make it more succinct. This was a complex example to untangle and communicate.)
Line 6: Line 6:
==Example==
==Example==


This example selects the [[Examples]] page, and includes parser function calls <code><nowiki>{{#dpl:}}</nowiki></code> used on that "Examples" page, passing its parameters to a surrogate template called [[Template:dpl.examples]]. All #dpl parser function parameters used on the "Examples" page can be used/accessed inside that surrogate template, to display their values in the output, though only <code><nowiki>{{{category|}}}</nowiki></code> and <code><nowiki>{{{ordermethod|}}}</nowiki></code> ''were'' used to pass their values to the output below. The <code>table</code> statement uses default table formatting in the first (empty) argument, the second, third and fourth arguments set the table header text. Since the <code><nowiki>{{#dpl:}}</nowiki></code> parser function was used on the page more than once, and <code>table</code> format was used (in which row of output are separated with the titles repeating) the page column also repeats for each one (separation and repeating title would not be the case in some other output formats). A value is only displayed for cells that use the corresponding parameter, otherwise they'd appear empty.
This selects the [[Examples]] page, and includes all DPL3 parser function calls <code><nowiki>{{#dpl:}}</nowiki></code> used on that page. The parameters of each <code>#dpl</code> statement used on [[Examples]] are passed to, and can be used in, a surrogate template. The surrogate template specified ends in the chosen ".examples" suffix, resulting in: [[Template:dpl.examples]]; that surrogate only makes use of the <code><nowiki>{{{category|}}}</nowiki></code> and <code><nowiki>{{{ordermethod|}}}</nowiki></code> parameters, to pass those parameter's values to the output. The <code>table</code> statement applies default table formatting in the first argument (left empty, defaults to <code>class="wikitable"</code>), the second, third, and fourth arguments set the table header text. Since <code><nowiki>{{#dpl:}}</nowiki></code> was used more than once on the [[Examples]] page, one line of output for each instance appears (and <code>table</code> format separates these per line with a repeating title, where other formats may list the title once and the values thereafter).


<pre>
<pre>
Line 23: Line 23:
|table = ,Page,<code>category</code> parameter value, <code>ordermethod</code> parameter value
|table = ,Page,<code>category</code> parameter value, <code>ordermethod</code> parameter value
}}
}}

<noinclude>
<noinclude>
[[Category:Controlling output volume (examples)‎]]
[[Category:Controlling output volume (examples)‎]]

Revision as of 02:11, 21 April 2022

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 selects the Examples page, and includes all DPL3 parser function calls {{#dpl:}} used on that page. The parameters of each #dpl statement used on Examples are passed to, and can be used in, a surrogate template. The surrogate template specified ends in the chosen ".examples" suffix, resulting in: Template:dpl.examples; that surrogate only makes use of the {{{category|}}} and {{{ordermethod|}}} parameters, to pass those parameter's values to the output. The table statement applies default table formatting in the first argument (left empty, defaults to class="wikitable"), the second, third, and fourth arguments set the table header text. Since {{#dpl:}} was used more than once on the Examples page, one line of output for each instance appears (and table format separates these per line with a repeating title, where other formats may list the title once and the values thereafter).

{{#dpl:
|title = Examples
|include = {#dpl}.examples
|table = ,Page,<code>category</code> parameter value, <code>ordermethod</code> parameter value
}}

Result

{{#dpl: |title = Examples |include = {#dpl}.examples |table = ,Page,category parameter value, ordermethod parameter value }}