Dplvar: Difference between revisions

From DynamicPageList3 Manual
Content added Content deleted
imported>FrozenPlum
m (fix space)
imported>FrozenPlum
m (add purgenote)
Line 1: Line 1:
{{purgenote}}
{{DPL manual|section=dplvar}}
{{DPL manual|section=dplvar}}



Revision as of 06:38, 18 April 2022

Page Template:Purgenote/style.css must have content model "Sanitized CSS" for TemplateStyles (current model is "plain text").

Note: If the examples don't appear embedded within the page, please purge this page.
Manual dplvar

Syntax

Sets one symbolic variable name and assign a value:

{{#dplvar:set|varname|valueofvar}}

Sets multiple symbolic variable names and assigns values to them (one after the other):

{{#dplvar:set|name1|value1|name2|value2|..|..}}

Assigns a value only if the variable is empty / has not been used so far:

{{#dplvar:default|name|value}}

Returns the current value of the variable:

{{#dplvar:name}}
The variables can be set and retrieved from an article page or from templates used in that article.

Example

{{#dplvar:set|a|x|b|y|c|<!--empty-->}} {{#dplvar:default|a|aaaa}} {{#dplvar:default|c|cccc}} {{#dplvar:default|d|dddd}}

{{#dplvar:set|a|x|b|y|c|}} {{#dplvar:default|a|aaaa}} {{#dplvar:default|c|cccc}} {{#dplvar:default|d|dddd}} Result:

  • a={{#dplvar:a}}
  • b={{#dplvar:b}}
  • c={{#dplvar:c}}
  • d={{#dplvar:d}}

Notes:

  • Variable "c" was set to "cccc" because it was set but with an empty note (empty value).
  • Variable "d" was set to "dddd" because it was not already set.