Difference between revisions of "Lowest"

From Sega Retro

Line 10: Line 10:
 
:::Year will be another template that trims the date. It'll all be automatic when someone adds release dates. - [[User:Hivebrain|Hivebrain]] 21:04, 4 April 2012 (CDT)
 
:::Year will be another template that trims the date. It'll all be automatic when someone adds release dates. - [[User:Hivebrain|Hivebrain]] 21:04, 4 April 2012 (CDT)
 
: Apparently it doesn't work, unless I've done something wrong. - [[User:Hivebrain|Hivebrain]] 15:22, 10 April 2012 (CDT)
 
: Apparently it doesn't work, unless I've done something wrong. - [[User:Hivebrain|Hivebrain]] 15:22, 10 April 2012 (CDT)
 +
:: Because I goofed: it should be <nowiki>{{#var:x}}</nowiki> not <nowiki>{{{#var:x}}}</nowiki> — and I forgot to have an else clause for the #ifexpr:
 +
<pre>{{#vardefine:x|{{#expr:{{{1|9999}}} }} }}
 +
{{#ifexpr:{{{2|9999}}}<{{#var:x}} | {{#vardefine:x|{{#expr:{{{2}}} }} | }}</pre>
 +
::- [[User:Andlabs|Andlabs]] 00:40, 11 April 2012 (CDT)

Revision as of 00:40, 11 April 2012

{{#vardefine:x|{{{1|9999}}} }}
{{#ifexpr:{{{2|9999}}}<{{{#var:x}}}|{{#vardefine:x|{{{2}}} }}
{{#ifexpr:{{{3|9999}}}<{{{#var:x}}}|{{#vardefine:x|{{{3}}} }}
{{#ifexpr:{{{4|9999}}}<{{{#var:x}}}|{{#vardefine:x|{{{4}}} }}
...
{{{#var:x}}}

? - Andlabs 19:52, 4 April 2012 (CDT)

That's obviously much better if it works. If you were wondering, the purpose of this template is to find the earliest release year so that games can be automatically categorised. - Hivebrain 20:36, 4 April 2012 (CDT)
How would it be used in a page then — manually? Or do we have a way to do it automatically? - Andlabs 20:43, 4 April 2012 (CDT)
I'd use it in Template:Releases something like this: [[Category:{{lowest|{{year|md_date_eu}}|{{year|md_date_us}}|etc.}} Mega Drive games]]
Year will be another template that trims the date. It'll all be automatic when someone adds release dates. - Hivebrain 21:04, 4 April 2012 (CDT)
Apparently it doesn't work, unless I've done something wrong. - Hivebrain 15:22, 10 April 2012 (CDT)
Because I goofed: it should be {{#var:x}} not {{{#var:x}}} — and I forgot to have an else clause for the #ifexpr:
{{#vardefine:x|{{#expr:{{{1|9999}}} }} }}
{{#ifexpr:{{{2|9999}}}<{{#var:x}} | {{#vardefine:x|{{#expr:{{{2}}} }} | }}
- Andlabs 00:40, 11 April 2012 (CDT)