Questions tagged [mediawiki-templates]

In MediaWiki, templates provide a way to include one page into other pages. This tag is for questions about template code and functionality.

From Help:Templates:

If you have standard texts you want to include on several pages, the MediaWiki template feature comes into play.

Templates are standard wiki pages whose content is designed to be transcluded (embedded) inside other pages. Templates follow a convention that the name is prefixed with "Template:", assigning it to that namespace; besides this, you can create them like any other wiki page.

191 questions
2
votes
2 answers

Using css/html dropdown as Mediawiki template

I am trying to use this dropdown as a Mediawiki template and allow for Mediawiki parameters in the URL creation (I.e. {{PAGENAME}}). Apparently, this type of html elements is not parsed. Trying $wgRawHtml = true; resulted in the template being…
greektranslator
  • 499
  • 1
  • 6
  • 19
2
votes
1 answer

Template prints empty paragraphs

I have the following…
user2033412
  • 1,950
  • 2
  • 27
  • 47
2
votes
1 answer

MediaWiki get first letter of a string

I want to make a function that will choose "a" or "an" depending on the noun. I am getting that noun from {{PAGENAME}}, which will have Opal, Emerald, Diamond etc. Is there a parser function or something that I can use to get the first letter? Will…
2
votes
1 answer

Transclusion - These are not the Categories you are looking for

I have a template on Wikia http://shadow-of-war-mobile.wikia.com/wiki/Template:Orc This template eventually will nothing but a middle-man template through a chain of inheritence. But I digress, I need to figure out how to have the original article…
GoldBishop
  • 2,820
  • 4
  • 47
  • 82
2
votes
1 answer

Best way to make Mediawiki template which displays different content depending on parameter?

I will have hundreds of biographies for characters which consist of some text, markup and image(s). I want to have a template where you can write e.g. {{Biography|Steven}} and it grabs that biography from a page of all bios where each one is linked…
o0o0o0o0o
  • 89
  • 1
  • 11
2
votes
1 answer

Why does bar graph get inverted when I use it in a infobox?

The code for the page is {{Infobox course | course_code = PH31011 | course_name = Quantum Mechanics I | department = [[Physics]] | credits = 4 | ltp = {{Data bars | columns = 6 | Jan| Feb| Mar| Apr| May| Jun | blue|Berries| 65| …
canonball
  • 515
  • 7
  • 22
2
votes
1 answer

How to change the location of the TOC in a MediaWiki skin

I'm woking on a MediaWiki skin for my site. For the page content I'm using html( 'bodycontent' ); ?> to output it all. Part of this, on longer pages, is the Table of Contents (TOC). I would like to move the location of the TOC out of the…
Justin808
  • 20,859
  • 46
  • 160
  • 265
2
votes
3 answers

MediaWiki custom skin: check if current page is main page

I'm setting up a bunch of different language mediawiki's on one codebase. So far most of it is working, but I want to use a main page that looks different than the rest of the pages. To do this I originally just added some css rules that only…
Stephan Muller
  • 27,018
  • 16
  • 85
  • 126
2
votes
1 answer

Mediawiki: Displaying a List does not work with infobox template

I created a new template and want to display a list inside my newly coded infobox. To get this working I was told to change the code like in this German tutorial. This is how my template Infobox Music currently looks like: |- {{#if:…
Otaku Kyon
  • 415
  • 1
  • 9
  • 19
2
votes
1 answer

regex to match up to first occurrence of

I have this text: {{Infobox Item |name = value |prop2 = value |prop3 = value }} it's from a mediawiki template. i have the following regex: preg_match('/\{\{Infobox Item.+\\n\}\}\\n/s', $text, $ra); I'm using PHP. I want to match the from…
Stephen K
  • 697
  • 9
  • 26
2
votes
1 answer

Semantic Mediawiki - Passing a variable to a template

I have the result of a semantic query. For one of the properties, a comma separated list, I want to separate each item and pass it as a parameter to a template. However, I am struggling to find a way to do this. For example; Query: {{#ask:…
mathQ
  • 23
  • 3
2
votes
1 answer

MediaWiki: Transclude pagename in template

I'm creating a dictionary-type MediaWiki, where each article is a dictionary entry, with the word as the pagename, and to show the pronunciation I want to be able to use a template like {{pronunciation|{{PAGENAME}}}}, to include the pronunciation…
nrowe
  • 21
  • 1
2
votes
2 answers

Split a string in semantic MediaWiki

I want to add a link using existing string in in my wiki page. This string will be appended to a url to form a complete URL. This string consists of many words, for example "Crisis Management in International Computing" I want to split by empty…
Ali Khalil
  • 93
  • 1
  • 2
  • 11
2
votes
1 answer

What is the best hook to use to edit transcluded text in MediaWiki?

I want to know how to edit a transcluded template before it is rendered in a MediaWiki page. What is the best hook for this? I've already tried ParseBeforeStrip and this doesn't act within the page I'm transcluding the template into only on the…
2
votes
3 answers

Unexpected Line Break in MediaWiki Template

So I have a MediaWiki template which I use within a table to represent one column. The code looks like this and works as I want it. <includeonly>{{#if:{{{name|}}}|''{{{name}}}: ''|}}{{#if:{{{food|}}}|+{{Food|{{{food|}}}}}|}}…
1 2
3
12 13