Difference between revisions of "GenreCatNav"

From Sega Retro

Line 1: Line 1:
 
{| class="toc plainlinks noprint" align="left"
 
{| class="toc plainlinks noprint" align="left"
 
|-
 
|-
|class="bottomtemptext" align="left"| '''[[:Category:{{{1}}} games|{{{1}}} games]] by [[Sega Retro:Determining Genre|Genre]]:''' {{
+
|class="bottomtemptext" align="left"| '''[[:Category:{{{1}}} games|{{{1}}} games]] by [[Sega Retro:Determining Genre|Genre]]:'''
#ifexist: Category:{{{1}}} action games | <div style="display:inline-block; text-align:center">[[File:Genre action.svg|40px|link=Category:{{{1}}} action games]]<br>[[:Category:{{{1}}} action games|Action]]</div> }} {{
+
{{#vardefine:catdata|action games,Genre action.svg,Action;
#ifexist: Category:{{{1}}} adventure games | <div style="display:inline-block; text-align:center">[[File:Genre adventure.svg|40px|link=Category:{{{1}}} adventure games]]<br>[[:Category:{{{1}}} adventure games|Adventure]]</div> }} {{
+
adventure games,Genre adventure.svg,Adventure;
#ifexist: Category:{{{1}}} game compilations | <div style="display:inline-block; text-align:center"><br>[[:Category:{{{1}}} game compilations|Compilation]]</div> }} {{
+
game compilations,Notavailable.svg,Compilation;
#ifexist: Category:{{{1}}} demo discs | <div style="display:inline-block; text-align:center"><br>[[:Category:{{{1}}} demo discs|Demo Disc]]</div> }} {{
+
demo discs,Notavailable.svg,Demo Disc;
#ifexist: Category:{{{1}}} educational games | <div style="display:inline-block; text-align:center">[[File:Genre edu.svg|40px|link=Category:{{{1}}} educational games]]<br>[[:Category:{{{1}}} educational games|Educational]]</div> }} {{
+
educational games,Genre edu.svg,Educational;
#ifexist: Category:{{{1}}} fighting games | <div style="display:inline-block; text-align:center"><br>[[:Category:{{{1}}} fighting games|Fighting]]</div> }} {{
+
fighting games,Notavailable.svg,Fighting;
#ifexist: Category:{{{1}}} miscellaneous software | <div style="display:inline-block; text-align:center"><br>[[:Category:{{{1}}} miscellaneous software|Misc.]]</div> }} {{
+
miscellaneous software,Notavailable.svg,Misc.;
#ifexist: Category:{{{1}}} puzzle games | <div style="display:inline-block; text-align:center">[[File:Genre puzzle.svg|40px|link=Category:{{{1}}} puzzle games]]<br>[[:Category:{{{1}}} puzzle games|Puzzle]]</div> }} {{
+
puzzle games,Genre puzzle.svg,Puzzle;
#ifexist: Category:{{{1}}} RPGs | <div style="display:inline-block; text-align:center">[[File:Genre rpg.svg|40px|link=Category:{{{1}}} RPGs]]<br>[[:Category:{{{1}}} RPGs|RPG]]</div> }} {{
+
RPGs,Genre rpg.svg,RPG;
#ifexist: Category:{{{1}}} racing games | <div style="display:inline-block; text-align:center">[[File:Genre racing.svg|40px|link=Category:{{{1}}} racing games]]<br>[[:Category:{{{1}}} racing games|Racing]]</div> }} {{
+
racing games,Genre racing.svg,Racing;
#ifexist: Category:{{{1}}} shoot-'em-up games | <div style="display:inline-block; text-align:center">[[File:Genre shmup.svg|40px|link=Category:{{{1}}} shoot-'em-up games]]<br>[[:Category:{{{1}}} shoot-'em-up games|Shoot-'em-Up]]</div> }} {{
+
shoot-'em-up games,Genre shmup.svg,Shoot-'em-Up;
#ifexist: Category:{{{1}}} simulation games | <div style="display:inline-block; text-align:center">[[File:Genre simulation.svg|40px|link=Category:{{{1}}} simulation games]]<br>[[:Category:{{{1}}} simulation games|Simulation]]</div> }} {{
+
simulation games,Genre simulation.svg,Simulation;
#ifexist: Category:{{{1}}} sports games | <div style="display:inline-block; text-align:center">[[File:Genre sports.svg|40px|link=Category:{{{1}}} sports games]]<br>[[:Category:{{{1}}} sports games|Sport]]</div> }} {{
+
sports games,Genre sports.svg,Sport;
#ifexist: Category:{{{1}}} table games | <div style="display:inline-block; text-align:center"><br>[[:Category:{{{1}}} table games|Table]]</div> }}
+
table games,Notavailable.svg,Table
|}{{clear}}
+
}}{{#vardefine:i|0}}{{#vardefine:j|0}}{{#while:  
<noinclude>
+
| {{#ifexpr: {{#len:{{#explode:{{#var:catdata}}|;|{{#var:i}}}}}} > 0 | true }}
<nowiki>{{</nowiki>GenreCatNav|system}}
+
| {{#vardefine:catdatasub|{{#explode:{{#var:catdata}}|;|{{#var:i}}}}}}{{#vardefine:catname|{{#explode:{{#var:catdatasub}}|,|0}}}}{{#vardefine:catimg|{{#explode:{{#var:catdatasub}}|,|1}}}}{{#vardefine:catshort|{{#explode:{{#var:catdatasub}}|,|2}}}}
For example,
+
{{#ifexist: Category:{{{1}}} {{#var:catname}} | {{incvar|j}}<div style="display:inline-block; text-align:center; padding-top:4px; width:70px; {{#ifeq: {{#expr:{{#var:j}} mod 2}} | 1 | background:lightgrey;}}">[[File:{{#var:catimg}}|40px|link=Category:{{{1}}} {{#var:catname}}]]<br>[[:Category:{{{1}}} {{#var:catname}}|{{#var:catshort}}]]<br>{{PAGESINCATEGORY:{{{1}}} {{#var:catname}}}} pages</div> }}
 +
{{incvar|i}}
 +
}}
 +
|}
 +
{{clear}}<noinclude>
 +
==Usage==
 +
<pre>{{GenreCatNav|system}}</pre>
 +
 
 +
===Examples===
 
  <nowiki>{{</nowiki>GenreCatNav|Mega Drive}}
 
  <nowiki>{{</nowiki>GenreCatNav|Mega Drive}}
 
becomes
 
becomes

Revision as of 16:15, 6 July 2018

Usage

{{GenreCatNav|system}}

Examples

{{GenreCatNav|Mega Drive}}

becomes

and

{{GenreCatNav|Saturn}}

becomes