Template talk:Hgame
WTF
I peeked at the template and noticed multiple duplications of this code: {{#ifeq: {{{game|{{#titleparts: {{FULLPAGENAME}}|1}}}}}|{{#titleparts: {{FULLPAGENAME}}|1}}|{{#titleparts: {{FULLPAGENAME}}|1}}|{{{game}}}}}
The same with better readability
{{#ifeq: {{{game|{{#titleparts: {{FULLPAGENAME}}|1}}}}}
| {{#titleparts: {{FULLPAGENAME}}|1}}
| {{#titleparts: {{FULLPAGENAME}}|1}}
| {{{game}}}
}}
So, it checks if the value of game is equal to the first part of fullpagename.
- if yes, it prints the first part of fullpagename
- if no, it prints the value of game
It prints a string equal to game in any case. I'm going to poke around the template a bit to get a better idea what's going on. - Loliturma (talk) 09:11, 24 March 2014 (UTC)
- The reason for that is to enable the template to guess it's game in a subpaged structure, so the game= parameter is no longer needed when using subpages - without breaking compatibility with the "classic" page structure of older games. The target is to reduce the number of parameters to the template and make the template more "smart". --hmoeller [ Talk - Contribs ] 10:33, 24 March 2014 (UTC)
- Ahhh, now I get the idea. However, the code did not do that: It doesn't work if the game parameter is unspecified. I guess the equal / not equal options were accidentally set backwards? Anyways, it could be simplified to
{{#if:{{{game|}}}|{{{game}}}|{{#titleparts:{{FULLPAGENAME}}|1}}}}
- Ahhh, now I get the idea. However, the code did not do that: It doesn't work if the game parameter is unspecified. I guess the equal / not equal options were accidentally set backwards? Anyways, it could be simplified to
human-readable version
{{#if: {{{game|}}}
| {{{game}}}
| {{#titleparts: {{FULLPAGENAME}}|1}}
}}
- That would print game's value if it is specified, otherwise it will print the first part of fullpagename. Is that what it should do? - Loliturma (talk) 11:28, 24 March 2014 (UTC)
- Forgot to mention: in case you need to duplicate a parserfunction in multiple places, it might be a good idea to place it into a template of its own, (eg. {{GetGameName}} or something) to simplify things. - Loliturma (talk) 11:39, 24 March 2014 (UTC)
- In fact, a simple {{{game|{{#titleparts: {{FULLPAGENAME}}|1}}}}} should do the trick. I'll check it on my testwiki. For the human-readable versions: those may mess with the spacing of e.g. lists, so beware --hmoeller [ Talk - Contribs ] 11:47, 24 March 2014 (UTC)
- Good point! I am not familiar with magic words inside parserfunctions inside parameter default values, but it definitely should work. Also, all normal whitespaces inside parserfunctions are ignored unless they're part of input/output strings.
- In fact, a simple {{{game|{{#titleparts: {{FULLPAGENAME}}|1}}}}} should do the trick. I'll check it on my testwiki. For the human-readable versions: those may mess with the spacing of e.g. lists, so beware --hmoeller [ Talk - Contribs ] 11:47, 24 March 2014 (UTC)
That's {{
#if:
string
| true | false
}}.
# First # Second # Third # Fourth
- First
- Second
- Third
- Fourth
- Compate with that one:
# First
{{#ifeq: 1 | 2 | * Second |}}
# Third
# Fourth
- First
- Third
- Fourth
- If you look very closely, the distance between "First" and "Third" is slightly larger than between "Third" and "Fourth", because theres an
{{#ifeq: 1 | 2 | * Second |}}in it on a line by itself - not rendered, as 1 is not equal to 2. Also, you see that the numbering starts again. This is because the function on its own line ends the list, and a new one is started. Now the same rewritten a bit:
- If you look very closely, the distance between "First" and "Third" is slightly larger than between "Third" and "Fourth", because theres an
# First{{#ifeq: 1 | 2 |
# Second |}}
# Third
# Fourth
- First
- Third
- Fourth
Can't we make a new template for navigation? At the moment we use Template:{{{game}}}} for the navigation contents, but my Idea is to use a new template Template:{{{game}}}Nav for the links. That would allow us to use the template with the game name e.g. @HomeMate as it was intended: We can put Template:Hgame with its parameters and even additional modivications if required on Template:*game* and use it on the game pages.
I think this would be more simple then it is now. --trololove (talk) 11:51, 24 March 2014 (UTC)
- Indeed that would make it much easier for other contributors to add game pages. I'd say we use
{{#ifexist: Template:{{{game|{{#titleparts:{{FULLPAGENAME}}|1}}}}}Nav
| {{{game|{{#titleparts:{{FULLPAGENAME}}|1}}}}}Nav
| {{{game|{{#titleparts:{{FULLPAGENAME}}|1}}}}}
}}
- so the template will pick
{{{game}}}Navif it exist,{{{game}}}if not. --hmoeller [ Talk - Contribs ] 12:48, 24 March 2014 (UTC)- Ok, I'll add the code --trololove (talk) 15:06, 24 March 2014 (UTC)
- Well, after multiple attempts I finally managed to insert your code WITHOUT braking the template :) --trololove (talk) 16:00, 24 March 2014 (UTC)
- Sorry if any of my changes made the template source harder to understand, I had the opposite intention. I'll stop messing with it. - Loliturma (talk) 16:15, 24 March 2014 (UTC)
- No sweat, Loliturma. If we all agree with the planned structure:
- Then we are set. No complex parser code to determine game or company, few code to determine if e.g. modpage is set or to chose a default category. Once a new game is announced, make the templates and contributors can go an make pages. What ya all think? --hmoeller [ Talk - Contribs ] 19:25, 24 March 2014 (UTC)
- Sounds good. For the layman, simple {{SomeGame}} in page source is probably easier to use and understand than {{hgame|abunchofparametersblahblah}} and the easily editable navlists would be retained. Adding games that don't have premade templates is still going to be hard, but I doubt that'll happen often, and it can also be covered in help. - Loliturma (talk) 17:41, 25 March 2014 (UTC)
- Sorry if any of my changes made the template source harder to understand, I had the opposite intention. I'll stop messing with it. - Loliturma (talk) 16:15, 24 March 2014 (UTC)
- Well, after multiple attempts I finally managed to insert your code WITHOUT braking the template :) --trololove (talk) 16:00, 24 March 2014 (UTC)
- Ok, I'll add the code --trololove (talk) 15:06, 24 March 2014 (UTC)
RfC: Suggestion for new hgame (and gamecompany) template
| This discussion is listed as an Active Talk Page. Please remove this template when the question has been answered. |
This is a semi-final version of the hgame template.
{|style="width:200px; margin-top:4px; border:2px solid black; float:right; clear:right; padding:3px; {{borrad|8px}}"
|-
|{{CompanyTop| {{{company|Company Missing}}} | {{{category|{{{company|Unknown}}}}}} | {{{modpage|}}} }}
----
<span class="plainlinks" style="font-weight:bold;">[[{{{game|{{#titleparts:{{FULLPAGENAME}}|1}}}}}]]</span>
<span class="plainlinks" style="font-size:80%; float:right;">[[{{fullurle:Template:{{#ifexist: Template:{{{game|{{#titleparts:{{FULLPAGENAME}}|1}}}}}Nav
| {{{game|{{#titleparts:{{FULLPAGENAME}}|1}}}}}Nav
| {{{game|{{#titleparts:{{FULLPAGENAME}}|1}}}}} }}|action=edit}} edit]] </span>
{{<noinclude>Template:</noinclude>{{#ifexist: Template:{{{game|{{#titleparts:{{FULLPAGENAME}}|1}}}}}Nav
| {{{game|{{#titleparts:{{FULLPAGENAME}}|1}}}}}Nav
| {{{game|{{#titleparts:{{FULLPAGENAME}}|1}}}}} }}}}
|}<includeonly>
[[Category:{{{category|{{{company|Unknown}}}}}}]]
[[Category:{{{game|{{#titleparts:{{FULLPAGENAME}}|1}}}}}]]
{{#ifeq:{{#titleparts:{{FULLPAGENAME}}|1}}
|{{#titleparts:{{FULLPAGENAME}}|0}}
|
|{{DISPLAYTITLE:{{#titleparts:{{FULLPAGENAME}}|1}}: {{SUBPAGENAME}}}}
}}</includeonly><noinclude>{{clear}}{{documentation}}</noinclude>
Note:
- The whole top box content, which is shared by {{hgame}} and {{gamecompany}} was moved to the dumb template
{{CompanyTop}} - the {{#ifexist:}} parts are still required for backward compatibility :(
- {{borrad}} is a template expanding to border-radius styles for various rendering engines
Here's the {{CompanyTop}} code:
<includeonly><span style="font-size:1.2em; font-weight:bold;">[[{{{1|Unknown Company}}}]]</span>
* [[Special:Recentchangeslinked/Category:{{{2|{{{1|Unknown}}}}}}|Recent changes]]
* [[:Category:{{{2|{{{1|Unknown}}}}}}|All pages]]
{{#if: {{{3|}}}
| {{#ifexist: {{{modpage}}}
|* [[{{{3}}}|Modding Guide]]
|* [[{{{3}}} modding guide|General Modding Guide]]
}}
|
}}
* [[Help:Tutorial|Wiki tutorial]]
* [{{fullurl:{{FULLPAGENAME}}|action=purge}} Purge] <small>(this page)</small>
<span style="margin-left:6px;">'''''all characters are at least 18'''''</span></includeonly>
<noinclude>{{Clr}}{{Documentation}}</noinclude>
Aaaand here's the changed {{Gamecompany}} template:
{|style="width: 200px; margin-top: 4px; border: 2px solid black; float:right; clear:right; padding:3px; {{borrad|8px}}"
|-
|{{CompanyTop|{{{company|{{PAGENAME}}}}}|{{{category|{{PAGENAME}} Games}}}|{{{modpage|}}}}}
----
<includeonly>'''Featured games:'''<span class="plainlinks" style="font-size:80%; float:right; color:blue;" >[[{{fullurle:Template:{{#if: {{{company|}}}|{{{company}}}|{{BASEPAGENAME}}}}Games|action=edit}} edit]]</span>
{{{{#if: {{{company|}}}|{{{company}}}|{{BASEPAGENAME}}}}Games}}</includeonly>
|}
<includeonly>[[Category:{{#if: {{{category|}}}|{{{category}}}| {{#if:{{{company|}}}|{{{company}}} Games|{{BASEPAGENAME}} Games}}}}]][[Category:Game Company]]</includeonly>
<noinclude>{{Clr}}{{documentation}}</noinclude>
All those templates were tested and seem to work on my testwiki. --hmoeller [ Talk - Contribs ] 19:19, 25 March 2014 (UTC)