Please remember to make use of the DML Wiki Manual of Style and Code of Conduct during your stay.

 Actions

Help

Help:Dplmatrix

From Dragon Mania Legends (DML) Wiki

Manual dplmatrix


This function is a side entry into DPL for which there are five parameters required in a specific order, the last of which is an indented list of article names that must be passed to DPL3 to generate a matrix view. With copy/paste a matrix can be easily transferred to Excel to polish it there, like turning column texts to vertical, highlighting cells etc.

Syntax

{{#dplmatrix: name | yes | no | mode | indented_list }} where:

  1. name – The desired name of the matrix. Appears in the upper left cell. Arbitrary wiki formatting, even images, are possible.
  2. yes – The desired text/symbol indicating a link – (default is x).
  3. no – The desired text/symbol indicating the absence of a link – (default is empty).
  4. mode – The mode to display rows and columns in. Accepted mode values are:
    • flip – When specified, rows and columns are reversed or flipped.
    • normal – Normal display – (default)
  5. indented_list The indented list of article names.
    • Source articles must start in column 1.
      • In the normal mode, these articles populate the first cell of rows, and either link to or don't, the articles listed in column headers as indicated by link symbols.
    • Target items must be indented by at least one space (in normal mode, they populate column headers).
    • After the article name ~~ may be used to set article title. Row and column headers hyperlink to the articles if titles are specified they are used instead.
    • Lines which are empty or contain only spaces are silently ignored.
    • If a source line is not followed by one or more target lines, an empty table row (or column in flip mode) is shown.
    • If the same source line appears multiple times, the targets are joined (added).

Examples

The best way to understand how #dplmatrix functions, is to view described examples, such as the ones included below. The first examples illustrate manually created indented lists, to better understand the basic matrix functions. The idea, however, is to use DPL3 to generate indented lists automatically, and also mark the links between them automatically, which is demonstrated in the last example.

Example 1:
This uses the #dplmatrix module to create a matrix, whose name is set to "Title". The second, third, and fourth values are left blank so each one defaults: the second defaults to x (indicating a link), the third defaults to  ([blank], which indicates no link), and the forth defaults to normal (the matrix layout mode).

The fifth parameter specifies the indented list contents. First listed (non-indented, as row title) are article names as the source, and then the (indented) article names as the targets. From this, DPL3 determines which target is listed under which source. For example, the "apple" article appears in both the "one" and "Two" source sections of the indented list provided, so they are each marked with an "x" by DPL3 in the corresponding table column and row.

{{#dplmatrix: Title||||
one
 apple
 apricot
two ~~ Two
 banana
 apple
three
four
 grape
 mango ~~ MANGO
two ~~ Two
   mango ~~ MANGO
}}

Example 2:
This uses the #dplmatrix module to create a matrix, whose first parameter (name) is set to "Page". The second parameter is set to (indicating a link/marker), the third is set to . (indicating no link/marker), and the fourth is set to flip (the matrix layout mode) to flip what is in normal column position to rows instead.

The fifth parameter specifies the indented list contents. Since the mode is flipped, the first items listed (non-indented, as column titles) are article names as the source, and then the (indented) article names as the row title targets. From this, DPL3 determines which target is listed under which source. For example, the "apple" article appears in both the "one" and "Two" source sections of the indented list provided, so they are each marked with an "x" by DPL3 in the corresponding table column and row.

{{#dplmatrix:Page|✓|.|flip|
one
 apple
 apricot
two ~~ Two
 banana
 apple
three
four
 grape
 mango ~~ MANGO
two ~~ Two
   mango ~~ MANGO
}}

Example 3:
This uses the #dplmatrix module to create a matrix, whose first parameter (matrix name) is set to "Dessert examples linking to Fruit examples". The second parameter is set to '''x''' (specifies a bold "x" as the symbol for indicating a link), the third is set to - (as the symbol for indicating no link), and the fourth is set to flip (the matrix layout mode), which flips normal column position to rows instead.

The fifth parameter specifies the indented list contents, in this case it is a DPL3 statement which sets Category:Dessert examples as the link source. Since the mode is flipped, the dessert examples appear in column headers. The DPL3 statement uses the format parameter to format the page title of each of the source links. Directly thereafter, the Help:Test matrix2 template is called, and the format statement passes to that template the page value of %PAGE%, and the category value of Fruit examples, which are used to create the nested part of the list (explained in examples below).

{{#dplmatrix:Dessert examples linking to Fruit examples|'''x'''|-|flip|
  {{#dpl:
    |category=Dessert examples
    |count=5
    |format=,%PAGE% ~~ %TITLE%\n²{Test matrix2¦page=%PAGE%¦category=Fruit examples}²,
  }}
}}

As can be observed by visiting their pages, the Apple Pie article links to the Apple article, the Chocolate Cake article links to the Plum article, and the Raspberry Ice Cream article links to both of the other two articles.

Notes

To better understand what is occurring in the DPL3 statement, and how it forms the required "indented list" format, it's best to remove it from the {{#dplmatrix:}}, so its output can be viewed alone. This makes visible how the DPL3 statement creates the first level (non-indented) part of the list, and calls a template to create the second level.

Example:

{{#dpl:
    |category=Dessert examples
    |count=5
    |format=,%PAGE% ~~ %TITLE%\n²{Test matrix2¦page=%PAGE%¦category=Fruit examples}²,
}}

Template content

Lastly, to understand the Test matrix2 template (which is a second DPL3 statement), and how it accepts the values passed to it earlier, and formats the indented part of the list, it is best to view its contents as well:

Help:Test matrix2 content:

This example sets the namespace to [blank] (the "Main" namespace), sets the category to "Fruit examples" as was passed from the other DPL3 statement, and sets the linksfrom value to %PAGE% as was also passed from that statement. The count is then restricted to five, and the format line creates spaces before the linked page title.

{{#dpl:
 |namespace=
 |category={{{category}}}
 |linksfrom={{{page}}}
 |count=5
 |format=,   %PAGE% ~~ %TITLE%\n,
}}
This Wiki is created by players for other players and is not maintained by, or affiliated with, the game maker (Gameloft).
Cookies help us deliver our services. By using our services, you agree to our use of cookies.