Elwiki:Editor Community: Difference between revisions

m
Line 42: Line 42:
*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.
*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.
*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>
<pre>
{{#switch: {{{Village|}}}
{{#switch: {{{Village|}}}
| 1={{#vardefine:Color|green}}
| 1={{#vardefine:Color|green}}
Line 49: Line 49:
| 7={{#vardefine:Color|orange}}
| 7={{#vardefine:Color|orange}}
}}
}}
</code>
</pre>
**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''''').
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.'''
'''Thank you if anyone can notice this.'''
}}
}}