Anonymous

Elwiki:Editor Community: Difference between revisions

From Elwiki
m
Line 38: Line 38:
| Title0=variable and loop functions requirement
| Title0=variable and loop functions requirement
| Content0=
| Content0=
I think variable and loop parser functions should be added to elwiki. Sometimes, loop and variable define makes benefits when making templates.
I think Variable and Loop parser functions should be added to elwiki. Sometimes, loop and variable define makes benefits when making templates.
'''For Example:'''
*In the template '''''tabs''''', I see you use lots of similar syntax only with different indexes. If you have var and loop, this can be done with simple statements.
*Moreover, if a template want to choose color for a certain village, (for example, if '''''<nowiki>{{{Village|}}}</nowiki>''''' equals 1, then use Ruben's theme color; this is better than directly pass through the color, because if you want to change color for Ruben, you do not have to change every page, what you need is to change the color setting in this template). And to do this, variable should be a good solution. You can simply do this if you have variable.
<code>
{{#switch: {{{Village|}}}
| 1={{#vardefine:Color|green}}
| 2={{#vardefine:Color|red}}
...
| 7={{#vardefine:Color|orange}}
}}
</code>
**Now, no matter what village, their corresponding theme color are set to variable '''Color''', then what you need to do is to pass '''''<code>{{#var:Color}}</code>''''' to the template with Color Settings (such as '''''Section''''').
**'''Thank you if anyone can notice this.'''
}}
}}