Jump to content

Examples/Parameter: tablerow (example 2)

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

Example

[edit source]

This lists pages from category Fruit examples, sets include to include the {{Fruit-Infobox}} template's "grows" parameter value, in first column, the full page name %PAGE% (including namespace) in the second, an intentionally blank/null parameter name in the third (to hold position for the next parameter), and finally the "image" (name) as the last. The table statement's first argument sets table's styles, the second uses - to suppress the otherwise automatic first column (with linked page name), then specifies the column headers for the 4 columns.

The tablerow statement sets a #dplvar (variable) named "varGrows", and specifies its corresponding include value "grows" using %%; and, as setting a variable doesn't also display that variable, %% is used again in that column to display it. Next, the page/title is linked to and set to italic, followed by repeating the value of column 1 in column 3 by calling it by variable name; that was done because the values otherwise cannot be used in columns outside the column order set in include, where setting the variable in the first column enables its use in the third column. Finally, the image (name) value %% is displayed in the fourth (last) column. Results are limited to a count of 5.

Code
{{#dpl:
|category = Fruit examples
|include  = {Fruit-Infobox}:grows:%PAGE%:<!--blank-->:image
|table    = class="wikitable mw-collapsible",-,1st col,2nd col,3rd col,4th col
|tablerow = ²{#dplvar:set¦varGrows¦%%}²%%,<i>[[%PAGE%|%TITLE%]]</i>,²{#dplvar:varGrows}²,%%
|count    = 5
}}
Result
1st col 2nd col 3rd col 4th col
On trees Apple On trees Red Apple Fruit With Black Background.jpeg
On vines Grape On vines Grapes on White Table.jpeg
On trees Orange On trees Orange, orange peel.jpg
Plum Plum on tree.jpg
On a tree-like plant Banana On a tree-like plant Banana-Single.jpg
Cookies help us deliver our services. By using our services, you agree to our use of cookies.