Search code examples
mediawikiwikimediawiki-templates

How to get the first page of a template using #switch?


I recently installed MediaWiki and I have created some templates. Now I want to create a template news that gives me only the first page, I tried with switch (in mysite.org/wiki/Template:Pagina_principale/Vetrina):

{{#switch: {{#expr: 1 + ({{CURRENTTIMESTAMP}} - 20000000000000) mod 6}}
  |1={{Vetrina/1}}
  |2={{Vetrina/2}}
  |3={{Vetrina/3}}
  |4={{Vetrina/4}}
  |5={{Vetrina/5}}
  |6={{Vetrina/6}}
  |{{Vetrina/1}}
}} · [[mywiki:Vetrina|Tutte le voci in vetrina]]<noinclude>[[Categoria:Template pagina principale|Vetrina]]</noinclude>

The pages mysite.org/wiki/Template:Vetrina/1 and mysite.org/wiki/Template:Vetrina/2, etc are news pages.

The problem is that it gives me this error, my wiki does not recognize #switch and I do not understand why.


Solution

  • {{#switch}} is part of the ParserFunctions extension, so you will need to install that.