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

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!

Template:Extra parameters

From DDO wiki
Jump to navigation Jump to search

Usage[edit]

This template can be used to add a variable number of parameters to a template call. Normally, this is not possible since all the template calls are evaluated at the same time. This is made possible with DPL as a parser function because parser functions are evaluated first and then comes the template call.

{{Extra parameters
 | templ = <!--The template to call. Mandatory-->
 | <!--Some standard parameters-->
 | extra1 = <!--Extra parameters from a template call-->
 | extra2 = 
 | extraN =
}}
  • templ This is the template you would originally want to use with a variable number of parameters.
  • extraN Here you would normally use a template to generate the extra parameters. For example |extra1={{My template|some parameter}}. "My template" would create an output like {{!}}parameter1={{{some parameter|}}}1 {{!}}parameter2={{{some parameter|}}}2.
  • You can also add fixed parameters to the call. Any parameter passed to this template that does not start with the name "templ" or "extra" will be passed to the template specified in {{{templ}}} as well. If you wish to add parameters that start with "templ" or "extra" then you can add them next to the template name (specified in {{{templ}}}) separated with {{!}}.

Note: The DPL call tries to fetch the page "Non-existent page" and assumes it doesn't exist. If, for any reason, the page is created, the template will (hopefully) still work but might create unforeseen results. To counter that, please change the page name to a new and unlikely to exist name. To change the page name, edit this note and change the page name defined right before the note.

Examples[edit]

6
6
10
6

The above show that you can add fixed parameters to your template call exatly like you would have done if you called the desired template directly.

Now let's assume we have a template called "Test template" that takes 1 parameter (a number) and generates parameters with all the numbers up to this number. Code below:

{{#loop: counter
 | 1 <!-- starting value -->
 | {{{1|0}}} <!-- number of loops. Using the 1st parameter with a default value of 0 -->
 | {{!}} num{{#var: counter}} = {{#var: counter}} <!-- creating |num1=1|num2=2... -->
}}

Calling this template using "Test template" for extra parameters would do the following:

  • {{ Extra parameters | templ=Add | extra1={{Test template|5}} | prefix=num }}
  • {{ Extra parameters | templ=Add | extra1={{#loop:counter|1|5|{{!}}num{{#var: counter}}={{#var: counter}}}} | prefix=num }}
15

CODE[edit]

{{ }}