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!

Talk:Implicit passing of parameters to recursive template calls

From DDO wiki
Jump to navigation Jump to search
Forums: Index > Help desk > Implicit passing of parameters to recursive template calls

While processing Template:T1, I want to call Template:T2. I want to pass some args specifically to T2, but for the code to otherwise be evaluated in the same environment as it would if I directly evaluated T1.

If I just evaluate 'v' as {{{v|}}}, it substitutes away during transclusion (but including the template using 'safesubst' works).

Is it possible to escape {{{v|}}} such that it survives transclusion and is then evaluated in the context of T1?

Nom (ContribsMessage) 01:36, March 10, 2021 (EST)

  • I don't understand what you are asking exactly, but by having a look at your tests I believe you are trying to pass parameters to a subtemplate without the top template recognising them. This cannot be done in this way as each template's parameters are private to that template. Global variables however can be created using {{#vardefine: my-var | my-value}} or {{#dplvar: set | my-var | my-value}}. Those variables are global for the whole page (from the point they are defined to the end) and any transcluded templates can access them. The variables can also be created inside the templates and then accessed in the page. An exception to that is DPL calls. Variables declared or accessed in the phantom template may or may not exist in the page. I think dplvars do not have the same issues.

    The question now is why do you want to do that? Faltout (ContribsMessage) 09:16, March 10, 2021 (EST)