Examples/Parameter: table (example 3): Difference between revisions

Content added Content deleted
imported>FrozenPlum
m (FrozenPlum moved page Controlling output format/Parameter: table (example 1) to Controlling output format/Parameter: table (example 2) without leaving a redirect: Going to make a more simple first example to contrast between auto-first column and omitted first column)
imported>FrozenPlum
mNo edit summary
Line 6: Line 6:
==Example==
==Example==


This will select pages in [[:Category:Fruit examples]] and include the values of the "Fruit-Infobox" template's "image" and "grows" parameters, with the page title as a link in between the two template parameter values. The table statement sets the table styles to "wikitable" and "sortable" then uses <code>-</code> in the second position to omit the automatic page name/link first column (so it can be moved to a different column), and then it sets the table header text. The list output <code>{{DPL|count}}</code> is limited to 5 results.
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 within an <code>{{DPL|include}}</code> statement, see the <code>{{DPL|tablerow}}</code> parameter.


<pre>
<pre>
{{#dpl:
{{#dpl:
|category = Fruit examples
|category = Fruit examples
|include = {Fruit-Infobox}:image:[[%PAGE%|%TITLE%]]:grows
|include = {Fruit-Infobox}.templatevalues
|table = class="wikitable sortable",-, Image used on page, Page, Value of "grows" parameter
|table = class="wikitable sortable",Page,Grows,Image
|count = 5
|count = 5
}}
}}
</pre>
</pre>
Line 22: Line 20:


{{#dpl:
{{#dpl:
|category = Fruit examples
|category = Fruit examples
|include = {Fruit-Infobox}:image:[[%PAGE%|%TITLE%]]:grows
|include = {Fruit-Infobox}.templatevalues
|table = class="wikitable sortable",-, Image used on page, Page, Value of "grows" parameter
|table = class="wikitable sortable",Page,Grows,Image
|count = 5
|count = 5
}}
}}