Examples/Parameter: table (example 3): Difference between revisions
< Examples
Content added Content deleted
imported>FrozenPlum (Add an all-in-one (hopefully) explanatory example that is simple but explains the most commonly misunderstood components of the table statement, as separated from tablerow, which appears next anyhow. This example can then be used again and carried farther in "tablerow" in a cohesive way.) |
imported>FrozenPlum m (FrozenPlum moved page Controlling output format/Parameter: table (example 3) to Examples/Parameter: table (example 3): Simplifying how things are structured) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
==Example== |
==Example== |
||
This |
This selects articles in [[:Category:Fruit examples]] and uses a surrogate [[Template:Fruit-Infobox.templatevalues|template]] to format the second and third columns of results (the first column is automatically generated and populated by DPL3 because the second <code>table</code> value doesn't contain <code>-</code> to intentionally omit this, instead it contains the first column's table header "Page", and then sets the rest of the table headers. If <code>-</code> ''was'' in second position for <code>table</code>, the first column would drop off and the page name would need to be added to the first row of the surrogate template, it could be called with <code><nowiki>{{{%PAGE%}}}</nowiki></code> and formatted. |
||
'''Note:''' Other formatting (such as turning the image ''name'' into a ''rendered'' image) cannot occur in an <code>include</code> statement, see the <code>tablerow</code> parameter for formatting included <code>table</code> output. |
|||
<pre> |
<pre> |
||
{{#dpl: |
{{#dpl: |
||
|category |
|category = Fruit examples |
||
|include |
|include = {Fruit-Infobox}.templatevalues |
||
|table |
|table = class="wikitable sortable",Page,Grows,Image |
||
|count |
|count = 2 |
||
}} |
}} |
||
</pre> |
</pre> |
||
Line 22: | Line 20: | ||
{{#dpl: |
{{#dpl: |
||
|category |
|category = Fruit examples |
||
|include |
|include = {Fruit-Infobox}.templatevalues |
||
|table |
|table = class="wikitable sortable",Page,Grows,Image |
||
|count |
|count = 2 |
||
}} |
}} |
||
Latest revision as of 23:50, 31 March 2023
Example
This selects articles in Category:Fruit examples and uses a surrogate template to format the second and third columns of results (the first column is automatically generated and populated by DPL3 because the second table
value doesn't contain -
to intentionally omit this, instead it contains the first column's table header "Page", and then sets the rest of the table headers. If -
was in second position for table
, the first column would drop off and the page name would need to be added to the first row of the surrogate template, it could be called with {{{%PAGE%}}}
and formatted.
{{#dpl: |category = Fruit examples |include = {Fruit-Infobox}.templatevalues |table = class="wikitable sortable",Page,Grows,Image |count = 2 }}
Result
{{#dpl: |category = Fruit examples |include = {Fruit-Infobox}.templatevalues |table = class="wikitable sortable",Page,Grows,Image |count = 2 }}