Jump to content

Out of Ore Wiki:DPL Tricks

From Out of Ore Wiki

DPL3 Date Formatting in Tables

When using DynamicPageList3 (DPL3) to build version history or changelog tables, you may run into issues where the date values appear unformatted, even when using a helper template like {{OOO date}} that works elsewhere.

This page documents the root cause and solution.

Problem

DPL3 inserts data (like %% placeholders) after MediaWiki's parser has already run. So if you try this in a tablerow:

| tablerow = [[%PAGE%|%%]], {{OOO date|%%}}, %% , %%

…the template {{OOO date|%%}} is not parsed as a real template call. It just outputs as literal text, or sometimes breaks the row entirely.

Solution

Use DPL’s delayed evaluation syntax:

| tablerow = [[%PAGE%|%%]], ²{OOO date¦%%}², %% , %%

Explanation:

  • ²{ and (superscript 2) tell DPL to defer the parsing of the template call.
  • ¦ (section divider character) replaces the normal | pipe so DPL doesn't misinterpret it as a column split.
  • The result is equivalent to {{OOO date|2023-12-03}} at render time — and the date displays correctly as, for example, "December 3, 2023".

Example

If you're using an infobox like Template:Version infobox with a date field, and you want that formatted in your auto-generated table using the parser function form of DPL:

{{#dpl:
 | category    = Updates
 | namespace   = Main
 | ordermethod = sortkey
 | order       = descending
 | include     = {Version infobox}:version:date:type:summary
 | table       = class="wikitable sortable",-,Version,Date,Type,Summary
 | tablerow    = [[%PAGE%|%%]], ²{OOO date¦%%}², %% , %%
}}

This ensures every row uses the same readable date format consistently.

Notes

  • The Template:OOO date template should handle fallback and formatting via #time safely.
  • This technique works with both {{#dpl:}} and (in theory) <dpl> tag usage, though this example uses the parser function form.
  • The ²{...}² technique is also useful for wrapping #arraymap, #iferror, or even #invoke calls inside DPL output.

See Also

Feel free to expand this page with other useful DPL tricks or parser-related workarounds!