Anonymous user
Dplvar: Difference between revisions
m
Make this a bit easier to understand
imported>FrozenPlum mNo edit summary |
imported>FrozenPlum m (Make this a bit easier to understand) |
||
Line 2:
==Syntax==
'''Sets one''' symbolic variable name and assign a value:
<pre>
(1) {{#dplvar:set |name1|value1|name2|value2|..|..}}▼
</pre>
(3) {{#dplvar: name}}▼
'''Sets multiple''' symbolic variable names '''and assigns''' values to them (one after the other):
<pre>
(2) assigns the value only if the variable is empty / has not been used so far.▼
</pre>
(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.▼
<pre>
</pre>
<pre>
</pre>
▲{{note|The variables can be set and retrieved from an article page or from templates used in that article.}}
==Example==
<pre
{{#dplvar:set|a|x|b|y|c|
</pre>
▲{{#dplvar:default|a|aaaa}}
{{#dplvar:set|a|x|b|y|c|<!--empty-->}} {{#dplvar:default|a|aaaa}} {{#dplvar:default|c|cccc}} {{#dplvar:default|d|dddd}}
a={{#dplvar:a}}▼
'''Result:'''
b={{#dplvar:b}}▼
'''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.
[[Category:Other Modules]]
|