Year of the Dragon: Through April 23rd, claim the adventure pack Slice of Life for free! Speak to Xatheral in the Hall of Heroes.

Game mechanicsNewbie guideIn developmentDDO StoreSocial Media


ChallengesClassesCollectablesCraftingEnhancementsEpic DestiniesFavorFeats

GlossaryItemsMapsMonstersPlacesQuestsRacesReincarnationSkillsSpells


Please create an account or log in to build a reputation and unlock more editing privileges, and then visit DDO wiki's IRC Chat/Discord if you need any help!

Help:Phantom templates

From DDO wiki
Jump to navigation Jump to search

Phantom templates are not for normal use: they are employed by DPL queries to mix, remix and format parameters from its "parent" template and possibly some metadata.

In a nutshell:

Instead of collecting parameter values you can include the output of a 'surrogate' template (also called a 'phantom template'). DPL calls this template instead of the original template with the identical parameter list (plus the two additional parameters %PAGE% and %TITLE%). You will get the output of the surrogate template. To make this happen you specify the name of a template within single curly braces and add a suffix. As said before, the template name including the suffix will be called instead of the original template, with the same parameters, and the result will contain just the output of your alternate template

Phantom templates of this wiki can be found in Category:Phantom templates. Note that while phantom templates are initially designed to be used in DPL calls, some can also be used as normal templates given the correct parameters. In the same manner, normal templates initially designed to be used independently can also be used as phantom templates provided that their parameters have the same names as the included template's parameters (for example {{Quest}} and {{Adpack}} share the parameter |adpack=)

Code[edit]

The code for the phantom templates in a DPL call is usually

{{#dpl:
...
 | include = {page template¦phantom template}
...
}}

Alternate code:

{{#dpl:
...
 | include = {page template}.dpl
...
}}

In the above case, the phantom template's name is "Template:page template.dpl".

Example[edit]

  • Say I have a template called Template:A that takes the parameters |a=, |b= and |c=.
  • A page called Test page calls this template in the following manner:
This is a test page.

{{A
 | a = Hello
 | b = Hi
 | c = user
}}

End of test page.
  • Now, I create the following phantom template named Template:A phantom with the code:
{{{a}}} World! - {{{b}}} there. - Brought to you, by {{{c}}}.
  • And finally, I make the following DPL call:
{{#dpl:
 | title = Test page <!-- This will select the page "Test page" from the wiki database -->
 | include = {A¦A phantom}
 | mode = userformat <!-- This tells DPL not to use lists or tables or anything fancy to display the results -->
}}
  • The result will be:
Hello World! - Hi there. - Brought to you, by user.