Extension - DPL3/Table Example
From Dragon Mania Legends (DML) Wiki
< Help:Extension - DPL3Creating a formatted table in DPL3 can be a bit challenging, fortunately a step-by step approach (with examples) can make it much easier.
Contents
Table Output[edit]
An example of creating a DPL auto-table (only Bureaucrats should work with DPL3) is page name here page.
Select Pages[edit]
First we need to select the right pages to list in the output, so we start simple there.
Note: Notice the difference in syntax between the two different DPL use methods!
First we'll start with just displaying the list of items for output to see if we're getting the pages we expect.
Caution: Always intentionally limit the number of possible results you can get with
count=5
to avoid an unintentional huge result set:
Code:
{{#dpl: |category=Dragons |notcategory=Clan Dragons |notcategory=Boss Dragons |count=5 }}
Result
First we'll start with just displaying the list of items for output to see if we're getting the pages we expect (intentionally limited via count=5
to avoid a huge result set):
Code:
<dpl> category=Dragons notcategory=Clan Dragons notcategory=Boss Dragons count=5 </dpl>
Result
OOPS! Nope, ↑ that (above) is not what we wanted, and why testing initial output before output is so important.
We wanted Dragons-only so we need a category that houses only Dragons (which Standard Dragons
does):
First we'll start with just displaying the list of items for output to see if we're getting the pages we expect (intentionally limited via count=5
to avoid a huge result set):
Code:
{{#dpl: |category=Standard Dragons |notcategory=Clan Dragons |notcategory=Boss Dragons |count=5 }}
Result
First we'll start with just displaying the list of items for output to see if we're getting the pages we expect (intentionally limited via count=5
to avoid a huge result set):
Code:
<dpl> category=Standard Dragons notcategory=Clan Dragons notcategory=Boss Dragons count=5 </dpl>
Result
Include/Volume[edit]
Okay, so now that we're getting the pages listed in the output that we wanted/needed, lets include some template parameter values with it, we'll do page title, then cost. The "include" can be used to set parameter values to include in simple output (inline or table), separated by colons:
Simple List Include[edit]
By default the page name is already output into a simple list, so referencing the {template}:parameter
will include a page's parameter value (or chain of them {template}:cost:base:second:third
) followed by a comma. This lets us test that we're getting the parameter values from the template:
Code:
{{#dpl: |category=Standard Dragons |notcategory=Clan Dragons |notcategory=Boss Dragons |include = {DragonBox}:cost, |count=5 }}
Result:
- Abyss Dragon1,915
- Academic Dragon1,590
- Academy DragonUnbuyable
- Ace Dragon20
- Agave Dragon1,400
Simple Table with Include[edit]
Okay, now that we're getting the output we want, we can look at formatting it into a table. Notice we have:
to set format
listseparators
to start the table, set its header, and end the table.secseparators
customize the output format of included sections.secseparators=Start1,End1,Start2,End2,..,..
{{#dpl: |category = Uncommon (classification) |notcategory = Clan Dragons |notcategory = Boss Dragons |include = {DragonBox}:[[%PAGE%|%TITLE%]]:cost, |mode = userformat |count=5 |listseparators = \n{¦class="wikitable sortable" \n¦-\n!Dragon \n!Cost ,\n¦-,\n¦-\n¦-,\n¦} |secseparators = \n¦class="orange-box"¦,,\n¦, }}
Result:
Dragon | Cost |
---|---|
Armored Dragon | 400 |
Assassin Dragon | 8 |
Bee Dragon | 325 |
Breeze Rock Dragon | 299 |
Brick Dragon | 425 |
Note: Formatting is very limited in this simple table mode, for advanced formatting use a surrogate template.
<dpl> category = Uncommon (classification) notcategory = Clan Dragons notcategory = Boss Dragons include = {DragonBox}:[[%PAGE%|%TITLE%]]:cost, mode = userformat count = 5 listseparators = ¶{|class="wikitable sortable" ¶|-¶!Dragon ¶!Cost ,¶|-,¶|-¶|-,¶|} secseparators = ¶|class="orange-box"|,,¶|, </dpl>
Result:
Dragon | Cost |
---|---|
Armored Dragon | 400 |
Assassin Dragon | 8 |
Bee Dragon | 325 |
Breeze Rock Dragon | 299 |
Brick Dragon | 425 |