Dplvar: Difference between revisions
m (Azxiana moved page Dplvar to DPL:Dplvar without leaving a redirect) |
imported>FrozenPlum m (Formatting fixes/changes) |
||
(15 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{ |
{{DPL manual|section=dplvar}} |
||
== |
==Syntax== |
||
* '''Sets one''' symbolic variable name and assign a value: |
|||
<pre>{{#dplvar:set|varname|valueofvar}}</pre> |
|||
* '''Sets multiple''' symbolic variable names '''and assigns''' values to them (one after the other): |
|||
<pre><nowiki> |
|||
<pre> |
|||
(1) {{#dplvar:set |name1|value1|name2|value2|..|..}} |
|||
{{#dplvar:set|name1|value1|name2|value2|..|..}} |
|||
</pre> |
|||
⚫ | |||
</nowiki></pre> |
|||
⚫ | |||
=== Effect === |
|||
<pre> |
|||
⚫ | |||
</pre> |
|||
⚫ | |||
(1) assigns the values to symbolic variable names. |
|||
<pre> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
</pre> |
|||
⚫ | |||
⚫ | |||
== |
==Example 1== |
||
'''Part 1:''' |
|||
{{#lsth:Examples/Module: dplvar (example 1)|Part 1}} |
|||
'''Part 1 Result:''' |
|||
{{#lsth:Examples/Module: dplvar (example 1)|Part 1 Result}} |
|||
<br> |
|||
'''Part 2:''' |
|||
{{#lsth:Examples/Module: dplvar (example 1)|Part 2}} |
|||
{{ViewTest|Examples|Module: dplvar (example_1)}} |
|||
'''Part 2 Result:''' |
|||
{{#lsth:Examples/Module: dplvar (example 1)|Part 2 Result}} |
|||
==Example 2== |
|||
<pre><nowiki> |
|||
'''Example:''' |
|||
{{#dplvar:set|a|x|b|y|c|z}} |
|||
{{#lsth:Examples/Module: dplvar (example_2)|Example}} |
|||
⚫ | |||
{{ViewTest|Examples|Module: dplvar (example 2)}} |
|||
{{#dplvar:default|d|dddd}} |
|||
'''Result:'''<!-- |
|||
a={{#dplvar:a}} |
|||
-->{{#lsth:Examples/Module: dplvar (example 2)|Result}} |
|||
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}} |
|||
[[Category: |
[[Category:Other Modules]] |
Latest revision as of 03:04, 21 April 2023
|
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}}
Example 1
Part 1:
{{#lsth:Examples/Module: dplvar (example 1)|Part 1}}
Part 1 Result:
{{#lsth:Examples/Module: dplvar (example 1)|Part 1 Result}}
Part 2:
{{#lsth:Examples/Module: dplvar (example 1)|Part 2}}
Page Template:ViewTest/style.css must have content model "Sanitized CSS" for TemplateStyles (current model is "plain text").
Part 2 Result: {{#lsth:Examples/Module: dplvar (example 1)|Part 2 Result}}
Example 2
Example: {{#lsth:Examples/Module: dplvar (example_2)|Example}}
Page Template:ViewTest/style.css must have content model "Sanitized CSS" for TemplateStyles (current model is "plain text").
Result:{{#lsth:Examples/Module: dplvar (example 2)|Result}}