<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://temp.ufopaedia.org/index.php?action=history&amp;feed=atom&amp;title=User%3ATvol%2FGuides</id>
	<title>User:Tvol/Guides - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://temp.ufopaedia.org/index.php?action=history&amp;feed=atom&amp;title=User%3ATvol%2FGuides"/>
	<link rel="alternate" type="text/html" href="https://temp.ufopaedia.org/index.php?title=User:Tvol/Guides&amp;action=history"/>
	<updated>2026-05-03T12:44:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://temp.ufopaedia.org/index.php?title=User:Tvol/Guides&amp;diff=82207&amp;oldid=prev</id>
		<title>Tvol at 10:38, 10 February 2017</title>
		<link rel="alternate" type="text/html" href="https://temp.ufopaedia.org/index.php?title=User:Tvol/Guides&amp;diff=82207&amp;oldid=prev"/>
		<updated>2017-02-10T10:38:34Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:38, 10 February 2017&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l14&quot;&gt;Line 14:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 14:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Wherever a base template is being used by other templates and it is necessary for it to have known default parameters (for the sake of having standardized behaviour), this &amp;quot;design pattern&amp;quot; is recommended.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Wherever a base template is being used by other templates and it is necessary for it to have known default parameters (for the sake of having standardized behaviour), this &amp;quot;design pattern&amp;quot; is recommended.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=== Performance and Parser Limit Considerations ===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;In any case where the template is likely to be called often, it may be better to instead create a subpage for each template that only contains that constant&#039;s value. Less convenient to edit, and the subpages should be tracked for the sake of usability and future maintenance, but once a template&#039;s defaults have been finalized, this is the least expensive option. [https://meta.wikimedia.org/wiki/Help:Array#Summary_of_counts_for_template_limits More info here.] Note that this also comes with the caveat that it &#039;&#039;must&#039;&#039; be defined and return something; if a redlink is reached, the benefits of this method go out the window.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Use Booleans and #ifexpr Over #if ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Use Booleans and #ifexpr Over #if ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The #if parser function only checks if a string passed to it (usually a parameter) is empty or not. This is fine for doing exactly that, to check if a parameter has been explicitly set, but it has drawbacks if you&amp;#039;re trying to use it as a true/false check. It is better to use booleans for this purpose (where 0 is false and 1 or higher is true). Doing so allows for more complicated logic checks later, such as XOR, XNOR, etc. If you use just #if when what you really want is a true/false test, then you&amp;#039;re digging yourself into a hole; don&amp;#039;t do it.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The #if parser function only checks if a string passed to it (usually a parameter) is empty or not. This is fine for doing exactly that, to check if a parameter has been explicitly set, but it has drawbacks if you&amp;#039;re trying to use it as a true/false check. It is better to use booleans for this purpose (where 0 is false and 1 or higher is true). Doing so allows for more complicated logic checks later, such as XOR, XNOR, etc. If you use just #if when what you really want is a true/false test, then you&amp;#039;re digging yourself into a hole; don&amp;#039;t do it.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key tempufo_wiki:diff:1.41:old-82206:rev-82207:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Tvol</name></author>
	</entry>
	<entry>
		<id>https://temp.ufopaedia.org/index.php?title=User:Tvol/Guides&amp;diff=82206&amp;oldid=prev</id>
		<title>Tvol: Just some general advice re templates and parsers</title>
		<link rel="alternate" type="text/html" href="https://temp.ufopaedia.org/index.php?title=User:Tvol/Guides&amp;diff=82206&amp;oldid=prev"/>
		<updated>2017-02-10T09:55:37Z</updated>

		<summary type="html">&lt;p&gt;Just some general advice re templates and parsers&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Template Parameter Passthrough ==&lt;br /&gt;
&lt;br /&gt;
In cases where you want to create specializations of a template so they can be called easily and avoid code/markup duplication, but where there are defaults that should be used for the base template, you need a /Constants subpage for the base template. An example of this structure can be found by looking at any of the templates in [[:Category:Perks (LW2)]] and the base template for them, {{tl|Ability (LW2)}}.&lt;br /&gt;
&lt;br /&gt;
To set default values for the base template, I created {{tl|Ability (LW2)/Constants}}, which contains a single switch function, one for each default value. This is its sole purpose, to receive a test parameter and return what the default value should be.&lt;br /&gt;
&lt;br /&gt;
Then, to set defaults, but also allow them to be overridden, the intermediary template (say {{tl|Suppression (LW2)}} as an example) will need to contain something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
| b_name = {{{ b_name | {{Ability (LW2)/Constants | b_NAME }} }}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This provides a useful function, in that it exposes the base {{tl|Ability (LW2)}} parameter non-destructively (it won&amp;#039;t be overridden by anything if {{tl|Suppression (LW2)}} is called without it), and without duplication (each specialization accesses the constants subpage and does &amp;#039;&amp;#039;not&amp;#039;&amp;#039; contain the hard-coded default value). This most importantly makes it trivial to change default values for the template in future (simply edit one page, {{tl|Ability (LW2)/Constants}}), instead of requiring the editing of several hundred templates. (Also it&amp;#039;s best to follow programming convention and use all caps when setting these constant values to differentiate them, since MediaWiki provides absolutely no type checking of any sort.)&lt;br /&gt;
&lt;br /&gt;
Wherever a base template is being used by other templates and it is necessary for it to have known default parameters (for the sake of having standardized behaviour), this &amp;quot;design pattern&amp;quot; is recommended.&lt;br /&gt;
&lt;br /&gt;
== Use Booleans and #ifexpr Over #if ==&lt;br /&gt;
&lt;br /&gt;
The #if parser function only checks if a string passed to it (usually a parameter) is empty or not. This is fine for doing exactly that, to check if a parameter has been explicitly set, but it has drawbacks if you&amp;#039;re trying to use it as a true/false check. It is better to use booleans for this purpose (where 0 is false and 1 or higher is true). Doing so allows for more complicated logic checks later, such as XOR, XNOR, etc. If you use just #if when what you really want is a true/false test, then you&amp;#039;re digging yourself into a hole; don&amp;#039;t do it.&lt;/div&gt;</summary>
		<author><name>Tvol</name></author>
	</entry>
</feed>