Dplvar: Difference between revisions

16 bytes removed ,  1 year ago
m
Formatting fixes/changes
imported>FrozenPlum
m (FrozenPlum moved page Extension:DPL3/Dplvar to Dplvar)
imported>FrozenPlum
m (Formatting fixes/changes)
 
(7 intermediate revisions by the same user not shown)
Line 2:
 
==Syntax==
* '''Sets one''' symbolic variable name and assign a value:
<pre><nowiki>
(1) <pre>{{#dplvar:set |name1varname|value1|name2|value2|..|..valueofvar}}</pre>
(2) {{#dplvar:default|name|value}}
(3) {{#dplvar: name}}
</nowiki></pre>
 
* '''Sets multiple''' symbolic variable names '''and assigns''' values to them (one after the other):
==Effect==
<pre>
(1) assigns the values to symbolic variable names.
{{#dplvar:set|name1|value1|name2|value2|..|..}}
(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.
 
(2)* assigns'''Assigns''' thea value '''only if the variable is empty / has not been used''' so far.:
The variables can be set and retrieved from an article page or from templates used in that article.
<pre>
(2) {{#dplvar:default|name|value}}
</pre>
 
(3)* returns'''Returns''' the current value of the variable.:
==Example==
<pre><nowiki>
{{#dplvar:set|a|x|b|y|c|zname}}
</pre>
{{#dplvar:default|a|aaaa}}
The{{note|'''Note:''' variablesVariables can be set and retrieved from an article page, or from templates used in that article.}}
{{#dplvar:default|d|dddd}}
a={{#dplvar:a}}
b={{#dplvar:b}}
c={{#dplvar:c}}
d={{#dplvar:d}}
</nowiki></pre>
{{#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}}
 
<!-- Extension prefix in other languages:
 
==Example 1==
[[de:Erweiterung:{{subst:BASEPAGENAME}}]]
'''Part 1:'''
[[es:Extensión:{{subst:BASEPAGENAME}}]]
{{#lsth:Examples/Module: dplvar (example 1)|Part 1}}
[[fr:Extension:{{subst:BASEPAGENAME}}]]
'''Part 1 Result:'''
[[it:Estensione:{{subst:BASEPAGENAME}}]]
{{#lsth:Examples/Module: dplvar (example 1)|Part 1 Result}}
[[nl:Uitbreiding:{{subst:BASEPAGENAME}}]]
<br>
[[pl:Rozszerzenie:{{subst:BASEPAGENAME}}]]
'''Part 2:'''
[[pt:Extensão:{{subst:BASEPAGENAME}}]]
{{#lsth:Examples/Module: dplvar (example 1)|Part 2}}
[[ru:Расширение:{{subst:BASEPAGENAME}}]]
{{ViewTest|Examples|Module: dplvar (example_1)}}
[[zh:扩展:{{subst:BASEPAGENAME}}]]
'''Part 2 Result:'''
-->
{{#lsth:Examples/Module: dplvar (example 1)|Part 2 Result}}
 
==Example 2==
'''Example:'''
{{#lsth:Examples/Module: dplvar (example_2)|Example}}
{{ViewTest|Examples|Module: dplvar (example 2)}}
'''Result:'''<!--
-->{{#lsth:Examples/Module: dplvar (example 2)|Result}}
 
[[Category:Other Modules]]
Anonymous user