Template:YearNav: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
No edit summary
No edit summary
Line 4: Line 4:
| style="margin-left: 0px;margin-top:2px;line-height:110%;text-align:center; font-size:150%;"|[[Timeline]]  
| style="margin-left: 0px;margin-top:2px;line-height:110%;text-align:center; font-size:150%;"|[[Timeline]]  
|-
|-
|{{#ifexpr:{{PAGENAME}} > 9999|<center>'''[[Far future]]'''</center>|<center> [[{{nth|{{#expr:(({{PAGENAME}}-({{PAGENAME}} mod 100))/100)+1}}}} century]]{{in5|5}}<span style="font-size:150%;">{{PAGENAME}}{{in5|5}}[[{{#expr: {{PAGENAME}} - ({{PAGENAME}} mod 10)}}s]]|}}
|{{#ifexpr:{{PAGENAME}} > 9999|<center>'''[[Far future]]'''</center>|<center> [[{{nth|{{#expr:(({{PAGENAME}}-({{PAGENAME}} mod 100))/100)+1}}}} century]]{{in5|2}}<span style="font-size:150%;">{{PAGENAME}}</span>{{in5|2}}[[{{#expr: {{PAGENAME}} - ({{PAGENAME}} mod 10)}}s]]|}}
|-
|-
|{{#ifexpr:{{PAGENAME}} > 9999| |<hr>[[{{#expr:{{#sub:{{PAGENAME}}|0|4}}-6}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}-5}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}-4}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}-3}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}-2}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}-1}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}+1}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}+2}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}+3}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}+4}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}+5}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}+6}}]]}}
|{{#ifexpr:{{PAGENAME}} > 9999| |<hr>[[{{#expr:{{#sub:{{PAGENAME}}|0|4}}-6}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}-5}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}-4}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}-3}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}-2}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}-1}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}+1}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}+2}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}+3}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}+4}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}+5}}]]&nbsp;• [[{{#expr:{{#sub:{{PAGENAME}}|0|4}}+6}}]]}}

Revision as of 18:23, 24 April 2010

Instructions for {{YearNav}}
Do not directly call this template. It is used to support other templates. Once another template decides that the topic of a page is a year, this template will automatically provide a navigation box.

It is completely automatic, and has no user-definable parameters.

Sample output

Because this template is dependent upon detecting a PAGENAME that is a year, its output can only be seen on a year page. It is impossible to reproduce its results here. If you wish to test it, go to any year and add {{timeline}} to the page.

Future implementation

It may be that in the future the coding can be made a bit simpler. I haven't tried the following language on pages that are less than 4 digits long but it seems like it'd work:

{{#ifexpr:{{PAGESIZE:{{#expr:({{PAGENAME}}-6)}}|R}}>0|[[{{#expr:{{PAGENAME}}-6}}]]|nothin  }}  

czechout<staff />   03:52: Fri 22 Jun 2012 

Maintenance log

  • Template was fixed today in response to odd errors that were creeping up only on some pages. Most of the #ifexpr calls were replaced by simpler #ifeq calls, and this has alleviated a lot of the errors that were taking place, particularly in the 1990s and 2000s.
    czechout<staff />    20:47: Mon 03 Sep 2012