Dplvar: Difference between revisions
Content added Content deleted
m (Alianin moved page DPL:Dplvar to Extension:DPL3/Dplvar without leaving a redirect: Changing namespaces.) |
No edit summary |
||
Line 1: | Line 1: | ||
{{DPL |
{{DPL manual|section=dplvar}} |
||
⚫ | |||
⚫ | |||
<pre><nowiki> |
<pre><nowiki> |
||
(1) {{#dplvar:set |name1|value1|name2|value2|..|..}} |
(1) {{#dplvar:set |name1|value1|name2|value2|..|..}} |
||
Line 9: | Line 8: | ||
</nowiki></pre> |
</nowiki></pre> |
||
== |
==Effect== |
||
(1) assigns the values to symbolic variable names. |
(1) assigns the values to symbolic variable names. |
||
(2) assigns the value only if the variable is empty / has not been used so far. |
(2) assigns the value only if the variable is empty / has not been used so far. |
||
Line 17: | Line 15: | ||
The variables can be set and retrieved from an article page or from templates used in that article. |
The variables can be set and retrieved from an article page or from templates used in that article. |
||
== |
==Example== |
||
<pre><nowiki> |
<pre><nowiki> |
||
{{#dplvar:set|a|x|b|y|c|z}} |
{{#dplvar:set|a|x|b|y|c|z}} |
||
Line 33: | Line 30: | ||
c={{#dplvar:c}} |
c={{#dplvar:c}} |
||
d={{#dplvar:d}} |
d={{#dplvar:d}} |
||
[[Category:DPL Manual]] |
Revision as of 10:18, 12 July 2019
|
Manual | dplvar |
Syntax
(1) {{#dplvar:set |name1|value1|name2|value2|..|..}} (2) {{#dplvar:default|name|value}} (3) {{#dplvar: name}}
Effect
(1) assigns the values to symbolic variable names. (2) assigns the value only if the variable is empty / has not been used so far. (3) returns the current value of the variable.
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|z}} {{#dplvar:default|a|aaaa}} {{#dplvar:default|d|dddd}} a={{#dplvar:a}} b={{#dplvar:b}} c={{#dplvar:c}} d={{#dplvar:d}}
{{#dplvar:set|a|x|b|y|c|z}} {{#dplvar:default|a|aaaa}} {{#dplvar:default|d|dddd}}
a={{#dplvar:a}} b={{#dplvar:b}} c={{#dplvar:c}} d={{#dplvar:d}}