Open main menu
Warning! Please do not post any new comments on this page. This is a discussion archive first created in 2007, although the comments contained were likely posted before and after this date. See current discussion.


Some content has been removed, see also:

Template inside an image

I am trying to use an image [image{{{Image_Number}}}.gif] but all it displays is the wikitext. I want to call a template {{Template_Name|Image_Number}}} so that depending on the value of {{{Image_Name}}} a different picture is output. How can I get this to work?

A template with [[image:{{{Image_Number}}}.gif]] can be called with {{Template_Name|Image_Number=..}}}--Patrick (talk) 00:54, 30 October 2007 (UTC)

Template Only for Section Headers?

I have been trying for days (to no avail) to make a template with only the names of section headers to be used as a "headers template" for other pages. This way, all of my pages could have the same basic look and section headers, but I could go back and change only the names of the section headers if I chose to at a later time. Currently, the edit section links always take me back to the template itself, and I can't figure out a suitable workaround. Any help would be greatly appreciated. Thanks in advance. 20:59, 27 July 2007 (UTC)

Note for translators

Please note that example templates used on Help:Template are sometimes changed, together with corresponding changes of the page. People translating this page for use in another help namespace on Meta are advised to use copies of these templates, to avoid that after such a change the text of the translation and the template do not match anymore.

Older discussions

Some issues discussed here are not more state of the art for version 1.34.0-wmf.19 (44607c9)

MediaWiki 1.6.8 includeonly error?

I have MediaWiki 1.6.8 installed on my site and the works fine, but the includeonly doesn't work around categories...which is annoying. It works for everything else, just not category code. Is there a fix for this?

URLEncode of parameters in external URLs

I've made a parameterized template in I use the person's name both as a descriptive text and as a GET parameter to an external URL (

This works great for non-special-Norwegian characters.

Could it be possible to add a feature that did som url-encoding of params inside an external URL reference? --Bep 21:37, 3 Feb 2005 (UTC)

I don't know the answer, but for reference: this seems to be about nn:Mal:LenkerPersonNamnJente.--Patrick 22:39, 3 Feb 2005 (UTC)

Special pages in templates

Does that work? I cannot get it to work. I tried {{Special:MyPage}}. If it supposed not to work, what shall I do to include dynamic data (e.g. output from a php function)?

Thank you for your help!

  • I have the same question: I cannot get {{Special:MyPage}} to actually include the special page. Is it supposed to work? If not, is there a different way to do this? TIA --Krubo 17:42, 21 May 2005 (UTC)
  • Turns out this is Bug 813. A workaround might be to write an extension to call the specialpage. (And you could make a template to call the extension.) -- Krubo 23:08, 21 May 2005 (UTC)

I don't catch it. Why does en:Template:Pope in en:Pope Adeodatus work as I expected it to? --denny 00:38, 13 Jun 2004 (UTC)

Solved it. It's noted under restrictions already. --denny 08:21, 13 Jun 2004 (UTC)

where do I get a complete list of all template pages? -- 22:58, 14 Jun 2004 (UTC)

I think there is currently no automatic way, unfortunately. In Wikipedia there are manually updated lists en:Wikipedia:Template messages and en:Wikipedia:Navigational templates. Also you can search with Google in a domain, for "Template" in the title. But that is not up-to-date.--Patrick 00:22, 15 Jun 2004 (UTC)
Under Special Pages select All pages and then select template in the namespace. From this site you can go directly ther with a link [] AnyFile 08:14, 19 Apr 2005 (UTC)

I set up a wiki but for some reason, when I try to use templates it just shows up as a word in double curly braces in the page (i.e. nowiki). Do I have to enable templates somewhere? --HunterX 15:03, 29 Jun 2004 (UTC)

Note, removed HunterX's url because it triggered the spamfilter--MCroft 18:15, 16 November 2006 (UTC)

In version 1.2.6 you have to use {{msg:...}} and the MediaWiki namespace.--Patrick 21:11, 29 Jun 2004 (UTC)
Thanks for the help --HunterX 23:17, 29 Jun 2004 (UTC)
Same problem, still don't get it.

I'm sorry Patrick, I appreciate the explanation, but I still don't understand. I have 1.2.6 as well and created a template, e.g., Template:mytemplate When I try to pull it in with {{mytemplate}} I just get "{{mytemplate}}" printed. I tried {{Template:mytemplate}} and {{msg:mytemplate}} {msg:MediaWiki:mytemplate} none, and I am not sure what you are saying I need to do. --Memobug 09:12, 4 Jul 2004 (UTC)

Sorry, I was very brief. I mean make a page MediaWiki:mytemplate and refer to it with {{msg:mytemplate}}. E.g. see http://localhost/index.php/User:Patrick --Patrick 10:37, 4 Jul 2004 (UTC)
Thanks, I appreciate the help! --Memobug 02:47, 14 Jul 2004 (UTC)

Why does not subst allow parameters?

Why does {{subst:pl|target page|label}} ignore the parameters rather than applying them to Template:pl? --Eequor 04:41, 16 Jul 2004 (UTC)

Not an answer, just an addition

In general:

An attempt to specify parameter values is accepted as subst-syntax, but the parameter values are ignored. If the template has parameters, the result has them too.

Result in this case: [{{SERVER}}{{localurl:{{{1}}}}} {{{2}}}] showing up as {{{2}}}--Patrick 08:06, 17 Jul 2004 (UTC)

I tried out some alternatives for such a typing aid:

A subst-version template:pls: you type

{{subst:pls}}                    and get
[{{SERVER}}{{localurl:}} ]         

Save (messy to have such an intermediate result in the page history!), press Edit, and type the target and label.

[{{url}}a b] does not work, it gives [[{{{1}}}]a b]. You can use it anyway, then preview, and copy the result to the edit box, replacing [{{url}}a b].

[{{subst:url}}a b]                        works, it gives
[{{SERVER}}/w/wiki.phtml?title=a b]       equivalent with
[{{SERVER}}/wiki/a b]

rendered as b. But it is a rather poor typing aid, only three keystrokes less than the short version.

--Patrick 08:49, 17 Jul 2004 (UTC)

No caching of templates?

In a discussion about templates, I was told, "Requiring a database query everytime a few characters of html would suffice is wasteful." Does Mediawiki really look up the expansion for a template every time it comes across one? It should be very simple to cache the expansions. --Eequor 05:52, 17 Jul 2004 (UTC)

Template limit

(See also MediaWiki_1.3_comments_and_bug_reports#Template_limit)

Why is each template used on a page limited to five occurrences? --Eequor 05:52, 17 Jul 2004 (UTC)

Basically, to prevent a DOS attack. According to Tim Starling's comments in Parser.php, "Without countermeasures, it would be possible to attack the parser by saving a page filled with a large number of inclusions of large pages. The size of the generated page would be proportional to the square of the input size. Hence, we limit the number of inclusions of any given page, thus bringing any attack back to O(N)."
Angela. 10:16, 17 Jul 2004 (UTC)

Comment by Eequor, moved from page:

It is claimed that the restriction may protect against infinite recursion (see en:Template:Cp) or denial of service attacks, but these beliefs are based on naive assumptions (namely, that potential attackers have limited imagination); this is, instead, an example of programmer laziness (see en:Template:Z).
I second that. Furthermore, it really hurts some pages. Look at what a mess Wikibooks:Music:Scales and Intervals is, currently requiring no less than seven copies of a template. The only alternatives would be to use the glyphs less often (which would suck and hurt readability) or to use '#' and 'b' for sharp and flat (ditto). If we were to still be lazy about it then we can at least make the number larger than 5. - Furrykef 23:23, 29 Jul 2004 (UTC)
Worse, look at what Wikibooks:Music:Modes has become. And there were more flat glyphs that I cut out. I'm giving up. - Furrykef 23:40, 29 Jul 2004 (UTC)
This really, really, really should be configurable in LocalSettings.php. The maintainer of a MW site ought to be able to assess the risk of turning this up on their own. Grr. - KeithTyler 18:06, 3 Jan 2005 (UTC)
Which file and line I have to change to lift this restriction? tommy 17:00, 4 Apr 2005
- Sorry, found it. Change define( "MAX_INCLUDE_REPEAT", 5 ); on file Parser.php

parameters not working inside links?

This seems like it shouldn't be an outlandish use of parameters, but for some reason when I put [[{{{parametername}}}]] or [[{{{parameter1name}}}|{{{parameter2name}}}]] in a template, I do get links to the correct pages but they are always edit links, even when those pages clearly exist (it's not a naming problem because they go to the right pages, they just go there in edit mode). Compare the infobox at the bottom of w:en:The Amazing Adventures of Kavalier & Clay and my templatized attempt on w:en:User Talk:LordSnow (w:en:Template:Literary award navigation). --Hob 16:26, 6 Aug 2004 (UTC)

Yes, this is mentioned under Restrictions, with some workarounds. It has also been reported as bug.--Patrick 23:51, 6 Aug 2004 (UTC)
Thanks, I hadn't understood the explanation in Restrictions but I do now (I think). Unfortunately the workaround (adding a "w:" prefix) has the side effect of making all the links not be edit links, even if they should be (i.e. even if the target does not exist). But it's better than nothing. -- 05:51, 7 Aug 2004 (UTC)
Nowadays this works.--Patrick 23:41, 21 May 2005 (UTC)

I suggest create Wikimedia Metawiki pages in other languages: spanish, english and so on. If no, the help doesn´t give fruits for people that speak other languages.

Isn't the piping restriction in parameters fixed now? It seems to work fine in en, so maybe it should be taken off this help page as a restriction?

Thanks, I changed it.--Patrick 14:21, 19 Aug 2004 (UTC)

[[category:{{{1}}}]] does not work, why? --[[User:Zy26|zy26 (Talk)]] 05:07, 2004 Aug 27 (UTC)

Works with the latest version: {{ca|talk}}--Patrick 20:58, 24 Sep 2004 (UTC)

But, how do you *create* a template?

Man, I must be super-dense --- I'm reading and re-reading this documentation, and I don't see any step-wise procedure for creating your first template. This whole Help section on Templates reads like math. Can anyone point me to a first-timer's guide to setting up and using templates?

Good point... you are not dense, it took me a while to get these working, just write one down! and the link to the template is created! (remember I'm using the nowiki tag to mark this {{template you want to have made}} then view that page, and click on the link that represents the blank template, and have fun editing! the template namespace is "Template" AaronPeterson 12:37, 17 Sep 2004 (UTC)

See also the simpler Help:A quick guide to templates.--Patrick 20:19, 17 Sep 2004 (UTC)

Suggestion, should the abovementioned quick guide link be added to the top of this article? Already listed are Help:Template and Help:Advanced templates, but no link to the quick guide on creating a template? I found these instructions impossible to understand myself Pthrasher 19:18, 23 October 2006 (UTC)
The link is there already.--Patrick 23:20, 23 October 2006 (UTC)

Duplication of content

When creating multiple versions of a document, say, a brief howto, and a more indepth article about that topic, it is often useful to have the briefer article embeded into the larger document. The gentoo project documentation sufferes from a bloat like no other. The installation instructions for gentoo can easily fit one one printed page. The handbook has page after page of trivia. Now, when a developer wishes to update a step in the guide, ve must edit two pages! the quick reference page, and the large document. This could result in the two not being in sync... which occurs occasionally.

Another reason to share content between pages is, many different procedures carry the same steps. These steps may be short, and may change frequently. A template is useful in those cases.

Basically, one must weigh how often said information it going to change, and how many places it is supposed to appear in, to make the call weather or not it is right to have that in a template.

Some of the nucances can be gotten rid of with the {{ed}} template, as it allows people to edit the contents of the template with relative ease. Also the use of <h1> <h2> <h3> tags in the contents of the template can help reduce the confusion, as the edit command won't appear next to them. AaronPeterson 12:37, 17 Sep 2004 (UTC)

Templates as parameters of Templates and parameters in images

I'm making an infobox (BeerBox) for my starting WikiProject about beers. Every beer has one logo, one name, one country, but it may have many varieties, so for every variety item I created a smaller infobox template (BeerBoxVariety and BeerBoxVarietyPic) for every variety that should be included inside the Beer infobox. But, since I use parameters for those sub-templates, the super-templates continues parsing all '|' symbols and messes it up.

I would not like to split my infobox in BeerBoxStart and BeerBoxEnd, because that would be a very dodgy workaround. So my first question is: is there a way to do this without having to make any structural changes to the templates?

My second question is: Is there a trick for using parameters in local image filenames (using for instance: [[Image:{{{myparam}}.jpg|36px|{{{myparam}}}])?

No, I don't think these are possible.--Patrick 20:33, 17 Sep 2004 (UTC)
Nowadays this works.--Patrick 23:39, 21 May 2005 (UTC)
With MediaWiki 1.9.3 it requires some hackery. I have Template:Imagebox that contains:

Due to the bug that unnamed parameters have white space preserved and named parameters have it stripped, this leads to a bug if the template is called with nice formatting:

 | foo.jpg

However, by bouncing through another template, passing the argument 1 as a named parameter, will strip the white space and allow it to work. That's a little frustrating, but a known limitation of the mediawiki template system. 19:24, 14 September 2007 (UTC)

w: and/or :Category questions?

I want to make a template that lets me convert {{c|bar}} to a link that implements [[:Category:foo|]]

However, [[:Category:{{{1}}}|]] doesn't work: it doesn't recognize it's supposed to be a link, and just puts the text with ['s and Category's.

From reading the talk comments, I suspect adding a w: prefix might be somehow related, but I don't want to mess with stuff I don't understand, and w: isn't documented on the template help page.

My question may or may not be related to zy26's question above: "[[category:{{{1}}}] doesn't work." When I tried that, I think it created a garbage category name. But with what I'm trying to do, I'm not trying to mark the article as a category, but rather include a link to a category. Thanks, Cphoenix 18:08, 24 Sep 2004 (UTC)

Somehow the abbreviated form does not work, write [[:Category:{{{1}}}|Category:{{{1}}}]], that works: Category:bar.--Patrick 20:47, 24 Sep 2004 (UTC)
The other works now. Both work here since very recently, so they only work in the very latest version.
W: means Wikipedia.--Patrick 21:03, 24 Sep 2004 (UTC)
How would the parameter {{{1}}} be auto-categorized and have a link to the category? I tried:
  1. [[Category:[[:Category:{{{1}}}|{{{1}}}]]]]
  2. {{category|[[:Category:{{{engine}}}|{{{engine}}}]]}}, with category containing [[Category:{{{1}}}]]
  3. {{catlink|{{{1}}}}}, with catlink containing [[:Category:{{{1}}}|Category:{{{1}}}]]
...but nothing works. :/ -Eep² 09:52, 21 July 2007 (UTC)
Just do both separately: [[:Category:{{{1}}}]][[Category:{{{1}}}]].--Patrick (talk) 11:20, 21 July 2007 (UTC)
Ah, yes, duh, of course. :P But I'd like to figure out a way to do it with a single command (preferably only referencing the parameter once). OK, actually, I can just create a template for that so I only have to type {{template|whatever}}. Thanks. -Eep² 20:52, 21 July 2007 (UTC)

Pipe trick does not work with a parameter

I suppose this is my problem... I want to have something like {{myinfobox|place=Burgos (city)}} render as a link [[Burgos (city)|]] so I try [[{{{place}}}|]]. The client page shows exactly [[Burgos (city)|]], not the link Burgos. The Spanish Wikipedia should already be using the very newest version, doesn't it? Any chance? 10:00, 10 August 2005 (UTC) Byj2000

You are right, the pipe trick does not work with a parameter. You can use something like Template:T pipe containing "[[{{{1}}} {{{2}}}|{{{1}}}]]" instead.--Patrick 22:10, 10 August 2005 (UTC)

Templates inside templates

I am buffled. If this

{{Γεγονότα 13ης Οκτωβρίου}} works

and this

[[Γεγονότα {{CURRENTDAY}}ης {{Γενική {{CURRENTMONTHNAME}}}}]] works

then why is it that this

{{Γεγονότα {{CURRENTDAY}}ης {{Γενική {{CURRENTMONTHNAME}}}}}}

DOES NOT WORK? See also el:Wikipedia:Αμμοδοχείο. The strange characters are Greek. el:User:ank 13 Oct 2004

It is in the article: An attempt to use a template with a name dependent on the content of another template does not work. The variables do not seem to be the problem, just the template with the name starting with Γενική--Patrick 20:59, 13 Oct 2004 (UTC)

Could someone please provide an explanation for this in English? How does one use a template inside of a template without having the included template being expanded immediate upon insertion?

That is something else, that works just like putting a template tag in any page.--Patrick 6 July 2005 20:19 (UTC)

traps (?)

  • First question: Why this Talk is in Category Talk?
  • Note: I have not read carefully all the documentation so far.
    • What happens if links to other languages are used in a template?
    • What happens if category links are used in a template? Regards Gangleri 04:56, 2004 Oct 18 (UTC)
  • I removed the demo that confusingly puts this talk page in category Talk.
  • I added a bit about the 2nd.
  • "A category tag in a template" is already there.
--Patrick 06:57, 18 Oct 2004 (UTC)


Update: I found a reference where someone accomplished what I am looking for. How is the {{NUMBEROFARTICLES}} feature at Hauptseite realised? I cannot find the source. It should be a template but there isn´t one with the name NUMBEROFARTICLES.

It is part of language.php (see also Language.php). Angela 11:50, 21 Oct 2004 (UTC)

Template parameters and categories

I've noticed when including [[category:{{{1}}}]] in a template the template is not added to any category, however if a parameter is used for alphabetization within a category (e.g. [[category:something|{{{1}}}]] the template IS added to the category, alphabetized under "{". Is there any way to prevent the template from being added to the category in the latter case? See, for exapmle, W:Template:Ticonderoga class cruiser.

Template similar to ~~~~~: possible?

Judging from what the text says, it seems it's not possible to construct a template that works like ~~~~~.

What would be needed to make it possible? Better yet... why not add a FORMATDATE thing that's similar to strftime(3)?

One can dream, can't one? ;-)

--Jae 16:09, 19 Jan 2005 (UTC)

Trivial Conditional Substitution (default values)

This is making my head hurt. Is there a simple way to make a template default an unspecified value? This is what I'm thinking:

<font size="{{{FontSize | 12}}}px"> Some Text </font>

So that if the template is called as:


we see huge text, but if it is called as:


we see default 12px stuff.

I tried putting templates of templates in my template but it just makes my head hurt really really bad, and doesn't give me what I want. (Specifically, I'm making an InfoBox and I want the align="" to be variable, but default right.)

Is this as hard as it seems?

You cannot specify a default value, the default value is the text {{{parameter number or name}}}. In the case of <font size> this works fine, because it produces invalid code that is ignored, you get the text in standard size. See Template talk:Fontsize.--Patrick 11:46, 18 Feb 2005 (UTC)
That's not good, though. I've looked at that example, and it works in my browser (Firefox), but can we be sure that all browsers will be happy with invalid options in the html tags they get? Wouldn't it be better to implement default values for templates? Another feature that might be nice would be conditional statements (though maybe that's getting a little technical for the average Wikipedian). For example, if for an infobox, you want to create 3 standard colour schemes. The template for the infobox takes an argument which specifies which colour scheme to use, then substitutes values for colours depending on the value of the colour scheme argument. --Kierano 13:37, 14 Apr 2005 (UTC)
PS: I can offer to code on this (default values for template arguments should be fairly quick), if it's decided that it's wanted (and when I get around to setting up mediawiki and a test databse locally). --Kierano 13:37, 14 Apr 2005 (UTC)
You can relax on the "generates invalid HTML" question - the HTML standards have always stated that if a browser doesn't understand an attribute or tag, it should silently ignore it. Thus, if a browser gets code that looks like <font size="{{Template:Font/medium}}">...</font> then all conforming browsers should simply ignore the font tag. Although rigid adherence to specs isn't traditionally a strong point of web browsers, conformance to this stipulation appears to be pretty much universal in my experience, ever since the very first versions of Netscape/IE.
Nevertheless, you're right - it's a nasty workaround for something that should be handled long before it hits the user's browser. 15:14, 19 October 2006 (UTC)
Nowadays a parameter can be given a default value.--Patrick 23:36, 19 October 2006 (UTC)
You can do this for a known fixed list of values using the following technique:
    <span style="font-size: {{Fonts/{{{FontSize}}} }}"> Some Text </span>


The trick here is that the template "Fonts/" contains the default value. For your example, if you really really needed to use pixel sizes, I guess you could create Fonts/1, Fonts/2, ... Fonts/999, but using names would be clearer, more consistent and more maintainable.
One problem with this approach is that it fails miserably when the template is called with an invalid argument eg {{Foo|FontSize=medium}} renders as Template:Fonts/medium"> Some Text which is not very nice. --80N 09:56, 24 Apr 2005 (UTC)
I think this way you have to put {{Foo|FontSize=}} to get the default, not just {{Foo}}.--Patrick 10:47, 24 Apr 2005 (UTC)
I'm also interested in having default values for templates. I'm running a wiki (the Knot Atlas) which hugely overuses templates, and default values would help a lot. If no one is hacking this yet, perhaps I'll start. --Semorrison 15:49, 30 August 2005 (UTC)
See the extension Winter for a way to set a default value. Frantik 03:15, 17 November 2005 (UTC)

templates without newline??

I'd like a template which creates numbered list items, including the list item e.g.

  1. first item
  2. second item

but if I do


The list keeps restarting at one. I know this is because there is an extra newline at the end of the template because I can do

{{temp|item1}} {{temp|item1}}

I then get a working list; this is very ugly and hard to decipher though. I've tried to save the template with no newline at the end, but wikipedia always adds it back. Is there any way around this? Mozzerati 09:17, 1 Apr 2005 (UTC)

Related: behavior doesn't match documentation

Above is exactly how the documentation on this page says it's supposed to work. However, the example provided in the page doesn't exhibit this behavior: numbering restarts only when two newlines are included between template tags. I.e.:

{{Numbered list demo}}{{Numbered list demo}}
{{Numbered list demo}}

produces numbering from one to nine, when according to the documentation as I read it, it ought to produce numbering from one to six, then from one to three. This behavior can be obtained by the following code:

{{Numbered list demo}}{{Numbered list demo}}
{{Numbered list demo}}

Incidentally, while writing this, I accidentally discovered the documented behavior can also be obtained by

{{Numbered list demo}}{{Numbered list demo}}
 {{Numbered list demo}}

Is this a bug in the software, or a flaw in the documentation? I.e., should I submit a bug report, or update the help page to reflect what actually happens? Adalger 23:00, 1 Jun 2005 (UTC)

I think the first is a bug-fix, I updated the documentation. The second is a detail about the effect of some odd wikitext, the effect is neither useful nor harmful, so perhaps it is not needed to document it.--Patrick 06:18, 2 Jun 2005 (UTC)

Browsing the many Patrick edits, it looks like only this new no-implied-newline behavior is described. At least one template's behavior was affected.[1] This behavior will be useful, but a description of the change is needed,[2] particularly so it is known if it was intentional or may vanish. ( 19:57, 2 Jun 2005 (UTC))
Yes, if the developer who made the change could explain it (or, if that has been done, point to it) that would be useful. It seems an improvement, with wikitext you can add but not delete a newline, so without unrequested newlines the editor has more control.--Patrick 22:30, 2 Jun 2005 (UTC)
I suppose the change is due to version 1.4.5, but listing the changes does not mention the change.--Patrick 02:33, 5 Jun 2005 (UTC)

Note broken

w:Wikipedia_talk:Footnote3#template:note_now_broken: Apparently an HTML-handling change broke the <cite> incantation which was used by w:Template:Note. ( 03:46, 5 Jun 2005 (UTC))

Same template, different contents

Is there a way to, and if so how does one, create a template into which different information could be added? For example, a template added to a page which automatically takes as its heading the title of that page. Or a template which could be used on many pages with a blank spot for a page specific table, such as the following table within a table:

Perfect fifth
# en:semitones en:Interval class # cents in en:equal temperament Most common en:diatonic name Comparable just interval # cents in just interval Just interval vs. equal-tempered interval
7 5 700 perfect fifth 3:2 702 2 cents larger
Other diatonic intervals
en:unison | en:minor second | en:major second | en:minor third | en:major third | en:perfect fourth | en:tritone | en:perfect fifth | en:minor sixth | en:major sixth | en:minor seventh | en:major seventh | en:octave

The bottom half of the table is en:Template:Diatonic intervals, while the top half is a table from en:Perfect fifth. The bottom half would be identical on all diatonic interval articles, while the top half would have different info for each. It's much more attractive and helpful as one table.

Is there a way to add {{Diatonic intervals}} and indicate content within (a blank space left for such a purpose in) that template? Thanks. Hyacinth 09:35, 1 Apr 2005 (UTC)

You can put {{Diatonic intervals}} in the page specific table, if that is what you mean.--Patrick 10:58, 1 Apr 2005 (UTC)

Templates for navigation

Does anyone know if it's possible to use a template to create a navigation structure at the bottom of a page? For examle, as you dig deeper and deeper into a discussion with multiple links, it would be nice to be able to link back through the tree where ever you are:

Main Page > Projects > Branding > John's Comments > Item 7

That way, you can move back easily to a certain level. I've seen this at [Help Pages]. Look at the bottom of the page. It shows as "Categories: ... "

Thanks, Russ

What you're seeing is a list of categories, not a trail of breadcrumbs representing the article's level within MetaWiki.
There is no clear linear path from one article to another (in most cases, that is), so I don't think what you are trying to do is possible. 13:00, 7 Apr 2005 (UTC)
Yes. The problem is that the category system is not a tree, but a Directed acyclic graph. In other words, an article may have multiple parents, going back to completely disparate branches of the classification system. A hierarchical navigation system like the one you've described doesn't work in such a system. --Kierano 13:51, 14 Apr 2005 (UTC)

Including only a section of a template...

Wouldn't it be nice to have a "Top stories" page including sections of an "All news" (template) page referenced by number? Something like...

  • Top 3 Stories page
{{:All news|section|1}}
{{:All news|section|2}}
{{:All news|section|3}}
For more see [[All News]].
  • All News page
== News item 1==
== News item 2==
== News item 3==
== News item 4==

Then users could "post a story" by adding a new section to the top of the All News page - quite intuitive. This avoids people's reticence to overwrite other people's news. -- Unfurtunately, I do not think this is possible,neither possible in the future. AnyFile

This would be very nice. 05:47, 2 May 2005 (UTC)

Template won't work + parameters trickle down

1) For some reason, the 6th template on one of my wiki's page refuses to work no matter what I'll do.

2) In addition, is it normal that a parameter used in a meta-template cannot be filled from it's calling templates? IOW, if I have Template:Problems as

<div stuff="stuff"> Attention, this article about {{{theme}}} has the following problems: {{{problems}}} </div> ***********************(you mean problem1?)--Patrick 14:32, 20 Apr 2005 (UTC)

and a child template Template:Factual problems as

{{problems|problem1=facts are doubtful and unverified}} <nowiki> is it normal if I cannot fill in the theme parameter from an article using {{factual problems}} with <nowiki>{{factual problems|theme=chemistry}} or {{factual problems|theme=botany}} ??

As the page says:

If a parameter is left undefined, the triple braced parameter name in the result does not function as a parameter if the page is called as a template from another page; if it should, do not omit the parameter value but specify it in terms of a parameter of the calling page.

--Patrick 14:36, 20 Apr 2005 (UTC)

Including dynamic data in a page?

I'm trying to build a template that will produce the output from a PHP script. Specifically, I want to build a template, call it PhoneListQuery, which will invoke a PHP script to search a phone number database and return the actual names and phone numbers requested. I should then be able to do something like {{PhoneListQuery|department=Physics}} and have the actual names and numbers appear in the page.

The best I've been able to get the template to return is a URL that correctly calls the script.

Any ideas?

Help:Template#Equals sign in parameter value

  • Thanks Patrick for your comments at [3]. Unfortunately anchors are not preserved in interwiki links there (bugzilla:2130). What surprised me was that I wanted to "quote" an unknown parameter with somthing like "FOO=" and was "forced to use" / needed to understand the correct syntax "1=FOO=" because for the paser no ambiguosities are allowed. Best regards Gangleri | Th | T 02:22, 2005 May 14 (UTC)

Default template parameters badly needed

I ran into exactly the same issue as in "Trivial Conditional Substitution (default values)" above. The same application, too - an infobox that can go on the right or left. And lastly, I had the same exact intuition for how it ought to work - I actually tried right, hoping that it would default to "right". 13:46, 17 May 2005 (UTC)

I'll add my voice to the choir. There's an obvious need for this and the workarounds are horribly hacky. WikiPedia:User:Jpatokal 06:17, 2 Jul 2005 (UTC)
It seems to me the "default template parameters"-feature has been added. Which mediawiki-version supports this feature? MediaWiki 1.5.0 on PHP 4.3.3 did not work for me. I appreciate any help. -- 15:55, 23 November 2005 (UTC)

The background in the Template

I don't know if I have missed something about creating templates. But I just want to know one basic thing - how do I make my page look like this Wikimedia page? I want a logo on the left, a background for my page, neat columns showing a menu for navigation etc... This is easy to create in basic HTML or using an include for the header/footer but I just could not figure out how to do the same as a template. Have I missed something in the template help or it's not in there at all?

- Radha

Templates can be used to control the page body, the margins are controlled by the skin and user style.--Patrick 11:53, 20 Jun 2005 (UTC)

inserting varying info into template

I'd like to make a template like this: "A version of this article in (name of language) has been listed at [[Wikipedia:Translation into English]]. " where people can insert the name of the language as appropriate. It seems, however, that I'd have to have a Masters degree in Maths to do this. Can anyone else help, or at least tell me if it is possible? Thanks! Saintswithin 19:32, 23 Jun 2005 (UTC)

Math in template parameters



Where Over is

<math>{ {{{1}}} \over {{{2}}} }</math>

The display is:


Is this working as designed? Any possibility of Templates being able to do <math>?

thanks, Fifelfoo 8 July 2005 01:51 (UTC)

MediaWiki variables and parameters cannot be used within math tags.--Patrick 8 July 2005 08:44 (UTC)

Using Templates as 'base code' for new pages?

  • Hi, I'm wondering if someone could help me - I was kinda hoping that creating a template would allow me to provide a base structure for a set of new pages (i.e. a list of sections) which could be filled out as necessary. Am I looking in the right place? Basically what I would like is for someone to be able to create a new page which has certain pre-defined generic contents already in place before they add their specific stuff.
  • I'm also interested in this, but I think templates is used differently. Wikimedia's use of templates sounds more like includes to me. For instance, if you have a paragraph of text to display on several pages, a Wikimedia template is used. However, if you want a framework for several pages or, what Microsoft Word calls a template, I'm not sure what to use?
  • Me three - is this impossible with Templates? Is there a better way? I want a means to automate the inclusion of a set amount of editable content in similar pages. In other words, all pages which are "Client Info" pages need to include specific sets of info, or at least use that specific set of info as a beginning point, to be further customized. Intuitively I thought this was what Templates did. Does anyone have suggestions? Thank you.
You could have a template Client Info with parameters, and for each client a page containing a template call with the individual client data as parameter values. These pages are rendered as the fixed content with the variable content filled in.--Patrick 22:16, 20 May 2005 (UTC)
  • Add another request for some way to define basic structure - our planned wiki uses a large number of pages with the sage basic structure needing to be defined - some form of "template" would aid in this...
  • Yet another party looking for the same. I want to write a template which is inserted into all new (empty) pages of a given Catorory, as a form to fill out. If one creates a page, he sees the template. --Remarkus 20:09, 11 January 2006 (UTC)
  • This is very interesting, and I am looking for answer also. But not yet.-----After exploring, I think it is really possible to use templates as 'base code' for new pages. Please read the section USAGE and try the Help:Long parameter demo, which are helpful.
See also help:inputbox.--Patrick 23:53, 11 January 2006 (UTC)
  • Me seven. So far, from my understanding, I think we need to create the template, say "Template:FooBar". Then create a page that has an help:inputbox using a preload= parameter. This is the page you direct all your users to when they want to create a new article. They'll just enter their new page's title and click to start writing the new page. In your parameter for the inputbox, you preload the Template:FooBar that you created. The template will be preloaded into the blank editbox when a new page is created. Presto! --MediaHound 23:04, 27 October 2006 (UTC)

Problems with Parameters

While creating a template as a guideline for what to fill inside a new page I do the following:



and it shows me:





instead of:





Am I doing something wrong?

This looks normal, if you use version 1.3, see [4]. Did you try to apply the template? Can you give a link?--Patrick 06:42, 25 Mar 2005 (UTC)

Hi, I'm having a small problem with parameters that I can't solve. I added a javascript to the Monobook.php file (which works fine) and I made a small Template:Tip which holds

<html> <span onmouseover="return escape('foobar')"> {{{1}}} </span> </html>

Then I call it with {{tip|phrase}}, the output on the page is {{{1}}} instead of the expected "phrase". Of course I would also like to substitute "foobar" with {{{2}}}. Any help is much appreciated. -- 15:50, 28 March 2006 (UTC)

I've just started looking at templates and as far as I can tell, parameters inside HTML tags are completely ignored. It seems to me that template expansion needs to be completed before any invocation of actions associated with tags even get started. DavidJameson 18:39, 4 August 2006 (UTC)

Template Usage Instructions

I don't see a good place to add it to this page, but it's helpful to put usage instructions to template users in the Talk page. See [5].

Good idea, done.--Patrick 06:06, 18 May 2005 (UTC)
(note that transwiki transclusion is not actually possible; you'll need to copy that template for it to be useful) — Xiongtalk* 14:12, 2005 May 18 (UTC)

External Links broken

None of the examples of external links look like they are working. The spaces mess everything up. Is thing something that has changed in the latest wiki code? -- 07:39, 30 Jun 2005 (UTC)

They are not supposed to link to existing webpages, they just illustrate what link label and link target name are produced.--Patrick 09:15, 30 Jun 2005 (UTC)

That is not the point, the examples do not appear to support the contention that, A blank space in a parameter value or template content that is substituted in a URL is not taken as ending the URL, but converted to %20., or for that matter, With external link style much is possible.

You would expect, for example, that in targetb label would yield label, but that would be an illegal domain name. What the reader of this section probably wants to do is automatically sub whitespace, so as to do either

  • {{MyURLTemplate|A article title}} --->
  • {{MyLinkTemplate|A article title|a label}} ---> a label


  • {{MyURLTemplate|A article title}} --->
  • {{MyLinkTemplate|A article title|a label}} ---> a label

This should be advised in the article, but since I haven't solved it myself, or know all the options (character replacement template?), better I not be bold and do that.

StrangerInParadise 15:47, 9 February 2006 (UTC)

I see now, the answer is to use {{localurl}}. See Help:Variable for more. The examples are still broken.

StrangerInParadise 16:54, 9 February 2006 (UTC)

Thanks, I removed the two sentences.--Patrick 12:31, 11 February 2006 (UTC)

Trying to emulate Help:Template

I noticed that #16 on the table of contents is a template, but the page isn't in the Template namespace. Also, the edit link actually points you to the proper page to edit. I'm trying to do the same thing on another Wiki, but when I tried to include something not in the Template namespace, it added "Template:" before the page name, when I put it in the Template namespace, the edit links are for the current page, not the template's page and the subsections don't appear on the current page's table of contents. The Wiki is using version 1.3, if that matters. Thanks.

It helps if you link to the page with the attempt.--Patrick 21:42, 21 August 2005 (UTC)
Ah, yes. Sorry. Basically, I'm trying to set it up so that the same information is on two pages. Anyway, the first page is: [6]
It's just the Java section that I'm working with right now.
The other page involved is: [7] and this time it's the Tutorials section.
Both have the same content and the same problems.
Just in case it's significant, the template being included is here: [8]
I think it due to the MediaWiki version, the feature works perhaps from 1.4.--Patrick 21:01, 22 August 2005 (UTC)
That's kind of what I figured... Thanks. We're looking at an update in September, hopefuly, so I'll be back if it's still a problem after that.

Compositing a section not the entire page...

Is there a way to insert a section from one page in to another, so that they share a section? I know you can share a section using templates but that would be time consumming for my application.

The applicaiton is to make a page that is a running journal regarding different pages (which in my case are my projects) I would like to composite a journal entry (i.e. section or subsection) in to one of my project pages so that a user can go to a project page and see the journal entries for that project or go to the journal and see all of the entries for every project.

Something along the lines of {{:page|section|subsection}} I hope that makes sense.

I am also looking for something similar. I have a central list of quotes made by various people and would like each subsection of quotes on the designated quote page to show up on their respective pages. Basically, I'd like the person's page to "call for" that subsection of quotes on the quotes page and I'd like it to show up on both pages whenever somebody edits that subsection. I hope this can be done, thanks 23:31, 30 May 2006 (UTC)
That's not possible. If you want to insert it it has to exist as separate page, typically a template, but any page incl. user or talk pages works. So instead of "insert section N from page Y here on page Z" you'd create a page X for this section, and then insert it on both Y and Z.
Minor problem, if page X contains headers ==X== or ===X.1=== etc. you'll get this header level also on pages Y and Z, they can't be different like say h2 on Y and h4 on Z. Maybe you could use a parameter to get different header levels, but I never tried this.
Don't forget that you can use <noinclude> etc. on all pages, not only in the template namespace. If you're sure that section N on page Y is the only section ever needed elsewhere (here on Z) you can exclude anything before and behind this section with <noincude>. If you then try to insert page Y on page Z you get only section N. -- Omniplex (w:t) 00:01, 31 May 2006 (UTC)

Parameters of a template within at template

How can I put parameters in a sub template? If I use template A which includes template B and both have a few numbered parameters, how can I assign values for both the parameters of template A and B, if I only use template A? See this example:

Template A looks like the following:

{{{1}}} {{{2}}} {{B}}

and template B looks like this:

{{{1}}} {{{2}}}

If I then use template A on a page without assigning any values to the parameters, I assume that it would look like this:

{{{1}}} {{{2}}} {{{1}}} {{{2}}}

However, if I assign values to the parameters in template A, like the following:


it should appear like this:

C D {{{1}}} {{{2}}}

But, if I want it to appear like this:


by assigning the values E and F to the two parameters in template B, how can I do that, using template A? Did anyone understand my question? / 18:40, 19 September 2005 (UTC)

You can call A with four parameters and give A the content
{{{1}}} {{{2}}} {{B|{{{3}}}|{{{4}}}}}
Patrick 13:18, 23 September 2005 (UTC)

Can someone help me create a doppelganger template for es:wiki?

Currently there is no template at es:wiki for doppelganger accounts. (At least according to one admin I am working with.)

Is there someone here who can help me create one? I've never done this before. I can coordinate the translation.

I'll also leave this message at en:wiki:Village Pump.

Paul Klenk

en:User:Paul Klenk 23:52, 3 October 2005 (UTC)

Never mind -- he created it. At es:wiki it is {{cuenta preventiva}}. 00:12, 4 October 2005 (UTC)

Changing many parameter values easily

Is it possible to change parameter values on some sort of list instead of in every article? Say, for the sake of argument, that I use the same template in 100 articles, called 1-100. In 50 of them I assign the value A to the parameter {{{Letter1}}} and in the other 50 I assign the value B to this parameter. However, I suddenly decide to assign the value A to this parameter in all 100 of the articles. Now, do I have to change B to A in all 50 of those that have B in them, or is it possible to have this on some sort of list, where it can be changed easily with just one edit for all 50 of them, like, for instance, a page called Parameters, where it states that the parameter value in article 1 should be A, in article 2 B and so on upp to 100? Thus, in all the articles, the parameter value for {{{Letter1}}} should be something like "call correct value from the list called Parameters". Is this possible? / 00:13, 18 October 2005 (UTC)

What you are requesting is a substitution dependent on PAGENAME of the calling page, here 1-50 vs. 51-100. See the 'depends on' sections in the Help page. The simplest solution is to create 2 templates TA and TB, called by the first and second sets respectively. If TA and TB share a significant amount of common content, consider putting the common content in TCommon, which each of TA and TB call. This nesting can create performance issues when the number of articles is large (1000+?) and TCommon needs to be edited frequently. See the Server Cache section and use of subst. Also, the TA/TB approach won't work where the structure of the parameterization varies, i.e. when you decide later that there are really 3 sets of article. -- LarryLACa 06:02, 12 November 2005 (UTC)

Effect of an undefined parameter if no default has been specified

An expert needs to review this section carefully. It appears that the text is slightly at odds with the examples. My guess is that the text describes behavior of an earlier version of Meta-Wiki, and so it needs to be updated. 21:46, 26 October 2005 (UTC)

Done.--Patrick 23:55, 26 October 2005 (UTC)

Lead paragraph Meta-Wikipedia Confusion

I thought the lead paragraph as displayed on wikimedia re: 'master source at Meta-Wikipedia' meant that the master source was kept at w:Help:Template. Not! Then I tried meta.wikipedia meta.wikipedia which did, AFAIK, a server redirect back to wikimedia, and my browser addressbar again showed meta.wikimedia. The attempt to use the master source only brought me back to 'Not Here' warning. Still confused.

Is the lead para. text just plain wrong? If not, it should be cleaned up to say 'at the Meta Wikipedia server' and moved to the (this) talk page, since it applies only to admins/implementor and only confuses general users. (of course this woulnd't be the first time I've totally misread something (here), and I could be just plain wrong ;-) Maybe it should be prefixed with a remark about when relevant, e.g. translation or installation. -- LarryLACa 23:26, 10 November 2005 (UTC)

I have clarified to "The master version of this page is the page m:Help:Template on Meta-Wikipedia." Since there is a link it should be clear even if you think Meta-Wikipedia means the project namespace of Wikipedia--Patrick 01:02, 11 November 2005 (UTC).
Readers are also advised to use the master version.--Patrick 01:04, 11 November 2005 (UTC)
Thanks for inverting the meaning. I hope this is right. Orginally it said the 'the maaster of this page, m:Help:Template, is on Meta-Wikipedia', which I thought meant this page is m:Help:template and the master is different and on Meta-Wikipedia. Now it says m:help:Template is the master on Mete-Wikipedia. Of course when you highlight the m:Help:Template link in your browser what you see is meta.wikimedia, which is the URL for this page, and austensibly lives on wikimedia, not meta-wikipedia.
I think the 'master copy' term is misleading, since this page is the master, and just happens to be served from wikipedia. Suggest rephras: The source for this page is served from meta-wikipedia and mapped to it's wikimedia link m:Help:Template. The template demos work on wikipedia, but may not... --

Official Guideline on Meta (Nested) templates, Cache Description

Wikipedia has an official policy guideline w:Wikipedia:Avoid using meta-templates which advises against nested templates used on a large number of pages (paraphrased). If this guideline is to be effective, shouldn't it be mentioned in the help page?

The essence of the guideline bears only on templates used on many pages, e.g. common stubs. Since users reading the help page are probably not editing stubs, immediate relevance to the primary audience may be limited. However, the general issue of performance should at least be mentioned, as in

  • a) be careful when editing templates used on many pages,
  • b) nested templates are not practical for cases where they will eventually be used on a large number of pages. I'm sure there are many budding infobox designers that read this page who should consider performance consequences if their boxes will be used on 100s of pages.

If I get no negative feedback and no-one jumps in, I guess I'll have to do it myself.. -- LarryLACa 23:26, 10 November 2005 (UTC)

There are some technical remarks at Help:Template#Server_efficiency (if you are an expert, please check). For many MediaWiki installations these things may not matter. I added a link to the specific policy of Wikipedia.--Patrick 01:16, 11 November 2005 (UTC)
Yep, beat me to it again. Thanks. I emphasized and moved impact considerations up in the article. I was going to add 2 more paragraphs about additional model considerations but decided it was not appropriate here. I left them as commented text in the page, should we decide to expand later. I think the title on the previous section needs to be changed to 'Cache updates' or some such. Too many opinions, not enough time.. LarryLACa 06:43, 11 November 2005 (UTC)

Cache Description Cleanup

I have moved (nearly) all the compounding cache caveats to a comment block in the article. The fidelity of the cache model is tangential or off topic (TOOT ?) for the main purpose here of the describing how to use/construct/design templates. All I've left visible is the simple model and a warning at the bottom, that it is simple, and an example of yet another compounding factor.

We do need a page on template edit cache impacts - primarily as server architecture documentation. For background see the en:Wikipedia:Avoid using meta-templates guideline statement the talk page, Xiong's page and it's talk page. The en: guideline was voted and accepted, but there is no clear statement of consensus on what an adequate model is. The Jamesday text in the policy body is largely an aside and only a partial example. The Xiong cost/benefit talk page indicates there was little consensus over that cost/benefit analysis (which is pretty meatless, and has too many yea-buts.)

Finding no accepted representation for the cache impact analysis, I could only go as far as summarizing factors in the comment block. Maybe someone will carry this further someday. -- LarryLACa 05:11, 12 November 2005 (UTC)

Request for improvement on Template Substitution

Hi *,

is there somebody who could help me or give me a hint, how to solve my particular Problem? I'm writing a wikibook on datacompression and would like to make it more flexible. So i created three different Lines, one to compare 2 algorithms one to compare three algorithms and one to compare 4 against a special testset. One of each Calgary lines represents the following structure.

  1. = CalgaryCorpus-Testset
  2. = Result with Algorithm 1
  3. = Result with Algorithm 2
  4. = Result with Algorithm 3
  5. = Result with Algorithm 4

I created a Template called CalgaryCorpusResults, wich is able to work generic on the Calgary Lines.

{| class="wikitable"
{{CalgaryLine{{{count}}}| |{{{algorithms}}}}}

I wanted to use the template like this:




As you can see, i want to use named parameters and transfer a set of parameters for the inner Template, but unfortunally algorithms consists only of the String {Algorithm1 instead of Algorithm1|Algorithm2|Algorithm3.

  1. Did someone had a similar solution which is implemented and properly working?
  2. Is there a trick for that?
  3. Did i made a simple mistake?

If not i would be glad to make a suggestion for improvement. -- ThePacker 16:58, 26 November 2005 (UTC)

Perhaps this is what you need: "If the expression for a parameter value contains a pipe character (|) which is not part of a piped link or within an image tag, it has to be put in nowiki tags: <nowiki>|</nowiki>."
Indeed i checked this 'feature'. But the Pipe charater is then ignored in the CalgaryCorpusResult Template also and will only fill the first parameter instead of n. I also tried to use a special Echo Sktipt with the simple Content {{{1}}}, to get rid of the nowiki Tags. But same result. This nowiki-Tag works global.
-- ThePacker 15:29, 27 November 2005 (UTC)
Being able to parse a parameter value would be interesting. Currently I do not think extracting "Algorithm1" from "Algorithm1|Algorithm2|Algorithm3" for use as separate parameter is possible. You can however supply parameters Algorithm1, Algorithm2, and Algorithm3 of which some are dummy, and use an if-construct such as Template:if equal [ talk edit history links ] to check that.--Patrick 10:25, 28 November 2005 (UTC)
I think parsing parameters might be overkill. What fits my problem, is something that could be called parameter-forwaring this would be less server-time-consuming. But i asked myself, if there is a possibility to replace each , (comma) by a | (pipe) symbol. I guess this could be helpfull, but i have to research, how templates are evaluated, to be sure, a substitution could solve my problem. Another solution could be to use something like an escaped pipe symbol(\|), which is forwarded as a simple pipesymbol. Any ideas ? -- ThePacker 23:07, 28 November 2005 (UTC)

Conversion of blanks in PAGENAME used for external URL?


I want to convert blanks in the special parameter PAGENAME into their url equivalent, i.e. %20, so that I can look up the article on other sites.

Is there a way to do this?


From a page called "two words", a call to a template like this:


The google_this template would be:{{PAGENAME}}

The result I would like:

The result I get:

Simply use PAGENAMEE -- hth

Creating a template scaffold for variables

I'm having a tough time figuring out how to separate template variables in the following way:

Row Column

If I want to call two sets of data to create the following array, how do I call the variables?

Ie. The scaffold is the table, {{Template:Array}}, consisting of {{Array|{{ColumnSet|Columns}}|{{RowSet|Rows}}}}), where one dataset would consist of a list of row listings

  • {{Rows|1|2|3||||||||and on as needed...}}

While another dataset would consist of column headings

  • {{Columns|A|B|C||||||and on as needed...}}

Such that {{{ColumnSet}}} and {{{RowSet}}} insert the appropriate variables in the proper places.

Thanks in advance, Kphunter 20:11, 15 December 2005 (UTC)

I do not quite understand the question, but see Template:power [ talk edit history links ] for a demo 2D array, where a for-call can give a row or column of choice.--Patrick 12:14, 16 December 2005 (UTC)
All I'm asking is how to create template files for the column and row headers.
For example: If I want to have the column headings years (2003, 2004, 2005, etc...), and the row headings numbers (1, 2, 3, etc...), can I create one template file that contains the years, a second template file that contains the numbers, and a third template file that contains the table framework so that they combine to create an array? -- Kphunter 04:44, 18 December 2005 (UTC)
Yes, you can use arrays for the headers. In the example I mentioned I use Template:t array 2 (talk, backlinks, edit) containing:


for the 1D array of column headers, which is in this case also the 1D array of row headers.--Patrick 12:01, 18 December 2005 (UTC)
Hmm...still not sure how to integrate what you're suggesting. Could you create a working copy using the above table? Thanks! -- Kphunter 18:53, 19 December 2005 (UTC)
On Template talk:Power a kind of double loop is used to create a small table with headers: the last example; above that are versions producing the same in a less automatic way, e.g. with a line of wikitext for each row.--Patrick 23:59, 19 December 2005 (UTC)
By the way, why would you want a scaffold with headers but without data? Or don't you mean that?--Patrick 00:08, 20 December 2005 (UTC)
My goal is to create a table that serves as a search array. I want to limit the number of pages I update that contain the same data, so I'm trying to see if templates are an option. In the table below, I'll have a "Years" page that can be referenced by other templates, and an "Events" page that follows the same format that can similarly be referenced by other pages. The cells themselves will contain DynamicPageList2 links (or actual data) based on the row and column headers:
2004 2005
Event 1 Results of parameter 2004 AND parameter Event 1 Results of parameter 2005 AND parameter Event 1
Event 2 same as above with parameter Event 2 same as above with parameter Event 2
Therefore, the "Events" page would contain something like {{TemplateEventHeader|Event1|Event2}}, and the "Years" page would be similar. A third template would have to have the information about how to render the table. I understand how parameter passing can allow generation of one set of headers, but I think the problem is that I'm trying to integrate two different sets of parameters. -- Kphunter 17:18, 20 December 2005 (UTC)
The last example on Template talk:Power v2 now uses an array for the row headers and one for the column headers. By the way, do you know on which wikis DynamicPageList2 currently works? Can you link to an example?--Patrick 16:30, 22 December 2005 (UTC)
See DynamicPageList2#Sites_using_DPL2 for a list of wikis using DynamicPageList2. --Dangerville 16:07, 24 September 2006 (UTC)

if Statements in Template? Or other solution?

I want to create an infobox, but I want it to display dynamically. For example, there will be a field called Died, and then the date of death of the person.

Some Dude
Born: December 25, 1764
Died: August 3, 1989

But if the person is still alive, I don't want it to show Died there at all, so it just looks like this:

Some Dude
Born: December 25, 1764

So how can I have it so:

  • If I don't pass a value to the argument "died", that it doesn't display the Died?
  • If I do pass a value, it will show it?

I would usually do this with an if statement in PHP or something, but am unsure if this is even possible in Wikipedia.

See w:en:Template talk:If defined, and make a separate template with the optional lines of table syntax, with the date as parameter.--Patrick 01:32, 25 December 2005 (UTC)
Syntax of if-statements looks like this:
{{#if:{{{param1|}}}| answer1 | answer2}}
Don't forget the pipe "|" immediately after param1 and the pipe just before answer1 as well as the one after it.
This will work even if "param1 = " assigning a null value to param1 exists in the calling page.
In such a case, defaultvalue will not give you defaultvalue, it will give you param1 which may be a null string or a blank. The null string or blank will produce "false" in the if-statement, though, allowing "answer2" to appear. So, if you want to allow the calling page to say "param1 = " (see wikipedia:en:Template:BirthControl infobox and how it is called on page wikipedia:en:Condom for example) then use the if statement above rather than just defaultvalue whenever you want to use the value of param1 in your template.
For your particular situation: use the if-statement to include or not include the line of text. See how it's done in the BirthControl infobox for example. You don't need to make any whole separate template -- you can do the two options within one template. --Coppertwig 03:40, 10 January 2007 (UTC)

If templates not working on my wiki

Templates such as w:en:Template:Switch, w:en:Template:Qif, and w:en:Template:If defined (copied and backlinked under the GFDL) aren't working on my installation of MediaWiki. Special:Version tells me I have MediaWiki 1.5.4, PHP 4.4.1 (cgi), and MySQL 4.1.13-standard-log, with extensions Makesysop and Permissions. What do I need to do for these to work? Simetrical 03:17, 4 January 2006 (UTC)

Clarification: if I type, for instance, the code

, with w:en:Template:Qif copied over to my wiki, it shows up as




, exactly as it appears here. Simetrical 07:05, 4 January 2006 (UTC)

These templates use parameter defaults, which work from MediaWiki version 1.6.--Patrick 09:47, 4 January 2006 (UTC)

Thanks for the info. Simetrical 07:36, 6 January 2006 (UTC)

Using templates to create composite documents from existing articles?

I'm trying to figure out how to create an article that is solely the content of several other articles. Transclusion through templates seems to be the way to go, but a bunch of the pages exist already. If I use {{ExistingArticle}} it creates Template:ExistingArticle. Is there any way around this so I can just grab existing info?


{{:ExistingArticle}}.--Patrick 00:59, 7 January 2006 (UTC)

Thanks kindly Patrick. After you posted that I looked back through the docs and the answer was staring right at me. Hopefully this isn't quite as foolish a question: Can a template be set up so that it hides when translocated? What I'm attempting to do is generate a page [[Index]] filled by other content (for printing big chunks of the wiki at once) through the use of the {{:ExamplePage1}} {{:ExamplePage2}} etc. but each ExamplePage has a template in it {{ReturnHome}} that creates a repeating link on the [[Index]] that is undesirable. Thanks again. Jeverett 02:29, 7 January 2006 (UTC)

You can put the {{ReturnHome}} tag between <noinclude> and </noinclude>, see Help:Template#Noinclude_and_includeonly. There is not a kind of "no-two-level-include" tag to put inside template ReturnHome.--Patrick 10:11, 8 January 2006 (UTC)
What happens if you use <includeonly><noinclude>blah</noinclude></includeonly>? Simetrical 08:20, 11 January 2006 (UTC)
I haven't tried this. Please try yourself and report.--Patrick 23:48, 11 January 2006 (UTC)
It seems anything wrapped in both an includeonly and a noinclude, no matter what the nesting order, shows up on neither the template page or any pages that transclude it at any level.

This is wrapped in includeonly only. This is wrapped in two includeonlys. This is not wrapped in anything.

I would guess this means that the software parses the tags in some definite order (one type then another), rather than from left to right or from the innermost out/outermost in. Too bad, but not a big deal (for me anyway). Simetrical 05:40, 12 January 2006 (UTC)

Thanks. I do not see why one would want to nest these tags, hence no notable limitation or opportunity.--Patrick 09:00, 12 January 2006 (UTC)

I have a related question. Is it possible to create a composite page dynamically from subpages? I want to have a [[Example]] page that is a composite of [[Example/pt1]], [[Example/pt2]], and so on without having to specify every subpage manually. Ideally the [[Example]] page displays a ---- between each subpage along with a link to the subpage.

Anyone? Anyone?... Danke mucho.

includeonly and noinclude before 1.6

I'm running 1.5.5 and includeonly and noinclude work for me. Being somewhat new I thought I'd ask.. should the doc be updated and when did this feature actually become available?

optional table row with template qif

Hi, I'd like to make a template of a table, similar to the infobox of chemical element, like Chlorine. What I need is to make almost every row optional in the template. So I imitate the style of the chemical element infobox, which is actually a set of templates, where each template is a row. It does the job, but I'm not completely satisfied. This method does not guarantee the ordering of the rows. Anyone can switch them.

So I'm wondering if there is a way to make a row optional in a big, multi-row template, using qif to test whether or not a template variable exists? --Chochopk 06:02, 18 January 2006 (UTC)

On the English Wikipedia there are objections against nested templates, such as using qif. For two other methods, see MediaWiki_talk:Common.css#Comparison_with_the_parameter_default_method. There is discussion on which is to be preferred.--Patrick 11:43, 18 January 2006 (UTC)

Clear up needed on 'default' values

I'm not exactly sure if the following explained on the help page:

The default (optional, together with the pipe character in front) can be different for every occurrence, and applies if no value is specified when calling the template, not to be confused with the case that the empty value is specified.

Is what i'm looking for, which is defining a default value for a variable which is not defined in the call, for example: In the template code, i have {| style="float: {{{float|left}}}"; , float being a variable and my chosen default value "left".

My expected result when the template is called without the float variable defined (Simply {{gumbox}}) would be to find this in the source code: <table style="float: left">

The actual result i get: <table style="float: & #123;& #123;& #123;float|left}}} (Of course without spaces on the character codes)

What am i doing wrong, or how do i actually define default values for undefined variables? -- 18:51, 9 February 2006 (UTC) (

{{{float|left}}} gives left, that works here. Please link to the page with the attempt.--Patrick 01:26, 10 February 2006 (UTC) -- 16:01, 11 February 2006 (UTC)
That is version 1.5.6, it works from 1.6.--Patrick 00:03, 12 February 2006 (UTC)
1.6 doesn't exist? Where does one find this version -- 04:16, 15 February 2006 (UTC)

Variable: {{CURRENTUSER}}?


Im just looking for a variable that gives out the name of the current user. I could not find such a varible anywhere. Is there one?

I hope u understand what i mean. Sorry for my english :)

basti -- 12:24, 14 March 2006 (UTC)

Help Setting Up Infoboxes?

I've read through all the info I can find, but I can't seem to get my Infobox templates working as I'd like them. I've created a template page here, but I want it to display in the same way as the one I created on Wikipedia here. I don't understand why my version doesn't contain the information in an actual box and why it isn't right aligned. I have edited my common.css file so that it should be correct and now I'm stuck. Can anyone help? Confused 22:20, 30 March 2006 (UTC)

How do you get a list of all available Templates

I have looked but not found a way of showing this. Anyone know how to do this? Thanks - JohnE.

I have found out how to do this. Link to this page on your web site: - JohnE

Tagging for citations in Wikiquote

The templates that work on Wikipedia don't seem to work on Wikiquote. For example, {{fact}} just leads to an empty Template page on Wikiquote instead of the functioning page on Wikipedia. Thanks for any help, Jim Butler 19:16, 2 April 2006 (UTC)

See Help:Template#Use_of_templates_across_projects, you have to copy w:Template:Citation needed to Wikiquote.--Patrick 11:18, 3 April 2006 (UTC)
Thanks! -Jim Butler 15:27, 5 April 2006 (UTC)

Once more templates inside templates

I´ve read the question above about the templates inside templates and so I tried to set up a template {{template1|parameter1}} (content of the template {{{1}}}) and a second template {{template2|parameter2}} (content of the template {{{1}}}) with the following usage {{template1|bla bla bla {{template2|la la la}}}}.

I thought the output should be something like

bla bla bla la la la,

but it is

bla bla bla{{template2}}

So seems as if the second template as parameter for the first one isn´t processed. But for {{template1|bla bla bla {{CURRENTMONTHNAME}}}} the result is as expected.

bla bla bla April

Any ideas? Kind regards

It looks like this should work, see Help:Advanced_templates#Including_the_content_of_a_template_in_a_template_or_variable_name_or_parameter_value. You may have tried it on an older version of the software.--Patrick 23:23, 5 April 2006 (UTC)

Spanning tags across multiple templates

I was trying to create a set of templates that would open a <div> tag in a starting template, have a template to fill out various fields within that section, and then a closing template that would close the <div> tag with a </div>. But the <div> tag seems to close itself within the first template, which keeps any of the other fields from being included within that div. Is there a way around it?

You can change Mediawiki code to ignore unclosed <div> and </div> tags with this ugly hack:
--- mediawiki-1.6.6-orig/includes/Sanitizer.php    2006-05-23 12:27:25.000000000 +0200
+++ mediawiki-1.6.6/includes/Sanitizer.php      2006-05-24 15:40:42.000000000 +0200
@@ -428,11 +428,15 @@
-                               $text .= '&lt;' . str_replace( '>', '&gt;', $x);
+                               if ($t != 'div') {
+                                       $text .= '&lt;' . str_replace( '>', '&gt;', $x); 
+                               } else {
+                                       $text .= '<' . $x;
+                               }
                        # Close off any remaining tags
                        while ( is_array( $tagstack ) && ($t = array_pop( $tagstack )) ) {
-                               $text .= "</$t>\n";
+                               if ($t != 'div') { $text .= "</$t>\n"; }
                                if ( $t == 'table' ) { $tagstack = array_pop( $tablestack ); }
                } else {
Unfortunately, this change will allow unmatched <div> and </div> tags that could break page layout.
There is a suggestion that something similar could be done with HTML Tidy but I haven't tried.


How do you make taxobox like a Wikipedia??

Here's what one looks like:

--Mitternacht 00:11, 5 May 2006 (UTC)

Parameter numbers

This remark (moved from the subject page) is obscure:

For an ordinary template {{foo|bar|fum|baz}} bar will be the 1st parameter, fum the 2nd, and baz the 3rd within the code of template foo. On the line calling template foo {{{1}}} is not bar, {{{2}}} is not fum, and {{{3}}} is not baz.

For a predefined template it's exactly the same situation. And because we never can look into a predefined template the question how it handles positional paramters internally is irrelevant from our POV (= caller). -- Omniplex (w:t) 03:32, 11 May 2006 (UTC)

Looking into {{ifeq demo|one|two}}, that's apparently a template taking two paramters. Its output is apparently something to be evaluated by #expr:, but it could be also displayed as string.
Trying {{ifeq demo|one|one}} I get one-one-1 as expected. Nothing special, one and one are equal, so that results in a 1.
Trying {{ifeq demo|+01|001}} I get +01-001-1, a known #ifeq:-bug or oddity (it compares numbers if it gets numbers), but still nothing special. -- Omniplex (w:t) 03:46, 11 May 2006 (UTC)

  • {{ #ifeq: abc | abc | 2=abce | 0 }} gives 2=abce
For normal templates a parameter can only get value "2=abce" by putting something like 1=2=abce, see first item of Help:Template#Restrictions_on_parameter_values, and in the section before that: "{{t|a|b|c}}" is equivalent to "{{t|1=a|2=b|3=c}}".--Patrick 07:56, 11 May 2006 (UTC)
Yes, that's very interesting, but I had no clue that it's related to your cryptic statement on the subject page. Maybe a simple comparison by example is better to make your point:
{{ #if: not blank | 2=equal sign in result }} expands into 2=equal sign in result
{{ ifdef | not blank | 2=equal sign in result }} expands into equal sign in result
It's documented why the latter won't work (normal = issue), but it's not yet documented that parser functions don't have this issue. Test for an older prededfined template:
{{ plural: 0 | singular | 2=equal sign in result }} expands into singular.
In other words colon functions / predefined templates / parser functions don't support the "named parameter" mechanism eating equal signs. That's IMO a good feature, no bug. -- Omniplex (w:t) 18:35, 11 May 2006 (UTC)
I did not suggest it is a bug.--Patrick 23:44, 11 May 2006 (UTC)
I read your original statement shown above as "something odd happens", odd could be bug or feature or else. After these experiments I'd say feature, one special character less to worry about in colon functions. -- Omniplex (w:t) 00:08, 12 May 2006 (UTC)
Sanity check because we know that predefined templates count 1 = between 1st and 2nd pipe, not 1 = between colon and 1st pipe:
Huh? I do not know a convention for that, and we just discussed that the system does not show any correspondence with a number.--Patrick 23:49, 11 May 2006 (UTC)
See 5678, demo, and known problems: In {{ colon: param1 | param2 | etc. }} the "param2" clobbers an undefined {{{1}}}, a 3rd param would clobber an undefined {{{2}}}, etc. But "param1" doesn't clobber an undefined {{{0}}}.
Ugly but harmless, because it doesn't affect defined parameters and also not parameter defaults, only the literal shown for undefined parameters without default is corrupted. -- Omniplex (w:t) 00:08, 12 May 2006 (UTC)
I see, thanks.--Patrick 09:16, 12 May 2006 (UTC)
{{ #if: not blank | 1=equal sign in result }} expands into 1=equal sign in result
All fine, one oddity with undefined parameters documented as bug 5678. Maybe 5678 also affects plural, test:
{{ plural: 0 | n/a | 5678 {{{2}}}}} expands into 5678 {{{2}}}
Strrrrrike, mediazilla:5678 is no parser function bug, it existed before. -- Omniplex (w:t) 18:50, 11 May 2006 (UTC)

mistake in chess example?

the parameter with autogenerated name "17" (at position a6 on the chessboard above) is assigned the empty string value.

But in the example, the parameter at position a6 is pd.

Thanks, I corrected it.--Patrick 23:47, 21 May 2006 (UTC)

alternative tags on mouseover for a template

hi, I want to extend an existing template by adding an alternative tag, when the mouse is over the image w:de:Benutzer:Andreas -horn- Hornig/Vorlage:3D alt. i want the notice "3D-Brille drücken, um zum alternativen 3D-Foto zu wechseln. Rot-Cyan 3D-Brille empfohlen für ihr Sehvergnügen" when the user is hovering over the 3d-glasses, so that he gets some kind of hint how to use the image to get to the alternative 3d-image by clicking on the same icon. can somebody help me how to get this? I am not used to templates like this and it was an existin template found here w:en:Template:3d alt. greets, --Andreas -horn- Hornig 15:15, 25 May 2006 (UTC)

Usage of template-parameters in <pre>

I wanted to create a template that puts a parameter in <pre>-tags. My approach was


but that will render {{{content}}} instead of its value. Is there any way to achieve this? --Sirius gd 15:40, 28 May 2006 (UTC)

Also tried out the following, that does not behave like I expected:


I do not know either, I tried Template:T includeonly pre [ talk edit history links ].--Patrick 06:26, 30 May 2006 (UTC)
Unfortunately <pre> has the side effect <nowiki> and another bug, this is a very dark corner of wikitext. If {{{content}}} is guaranteed to be a single line you can use <tt>, <code>, or similar. If it's more than one line, did you try the following?


It would trigger the same (says Brion) tidy bug for all later &nbsp; on the same page, but maybe that's irrelevant for what you plan. -- Omniplex (w:t) 23:11, 30 May 2006 (UTC)
Thanks for your tip, but it doesn't work for me. I'll write down, what i tried to do. I wanted a template, that takes some lines of a file as parameter and returns these lines within pre tags. Of course, i could pass the lines within pre-tags to the template, but the other way would give nicer page-code. So, my intend was a template-call in this form:
Description=Some C++ Snippet|
int main void() {
  std::cout << "bar";

That should result in some infobox including the preformatted code:

int main void() {
  std::cout << "foo";

I don't know if this can be done in any way in mediawiki. Your tip with <tt> does not work as the lines have indentation :\ --Sirius gd 05:11, 31 May 2006 (UTC)

  • The best I can come up with is {{msgnw:TEMPLATENAME}} as described here and here. If you wrap it inside either <tt> or <code>, you get the monospace format. I would still love to come up with some combination that gets it formatting and indented like <pre> though. — MrDolomite | Talk 22:24, 27 August 2006 (UTC)

Delete and try again from scratch

IMO this page is FUBAR, beyond repair. How about blanking it and start from scratch? Help pages are supposed to be simple, not all odd cases have to be explained with numerous ugly examples with incomprehensible names using templates only available on Meta and most probably not doing anymore what they were supposed to do since a vandal hit them years ago. This page is harmful, it's an unstructured enumeration. -- Omniplex (w:t) 06:08, 5 June 2006 (UTC)

Tags & Parser

Some templates recourse to a trick to allow conditional entry in an InfoBox, e.g., the Infox Film of Wikipedia with such entries as:

{{#if:{{{director|}}} | <tr><th>Directed by</th><td>{{{director|}}}</td></tr>}}

The trick is that explicit tags such as </th> or <td> are used because of | being the separator for #if (note that it would work to put table headers without explicit <th> as the Wiki counterpart is then !

!{{#if: {{{director|}}} | Directed by !! {{{director|}}} }}

(this would put an empty row in the table but it's not too serious). However MediaWiki (1.6.7) by default prevents expansion of tags such as <tr>, <th>, etc., from a template.

I would like to know what is a good way to achieve something like the Wikimedia Infobox conditional entries on a local MediaWiki (the parser being patched to accept if statements).

F.P. Laussy 16:12, 9 June 2006 (UTC)

Test template:! (edittalklinkshistory). -- Omniplex (w:t) 06:43, 15 June 2006 (UTC)

Parameters don't expand in component invocations

I'm trying to make a template that accepts a parameter and passes it to my own extension, but I can't make it work.

The invoking page:


The template:

<myextension xparam={{{tparam}}}> ... </myextension>

The {{{tparam}}} doesn't seem to get expanded when it occurs inside the extension element, so I can't figure out how to get "foo" passed to the extension. Am I doing something wrong?

That is also the case with TeX, see Help:Displaying a formula#Syntax.--Patrick 07:39, 13 June 2006 (UTC)

This seems to be a general flaw in the implementation of templates - parameters never get expanded if they're inside tags. DavidJameson 19:55, 4 August 2006 (UTC)

Noinclude and includeonly seems to work prior to v. 1.6

Just to say I am running MediaWiki 1.5.2 and it seems to have this function even though the page mentions this wasn't introduced until v. 1.6. --CharlesC 16:06, 28 June 2006 (UTC)

Can other namespaces be searched for templates?

I would like to use the {{name}} markup for writing content in my wiki, but if my templates are intended for use in a specific namespace, I'd like to have the templates reside in that namespace (or some subspace thereof). It seems unorganized to have templates from every namespace fall into the same global Template namespace. The result being that the content is organized but the templates are not. 22:45, 24 July 2006 (UTC)

Yes, if a is a real (custom) namespace you can use {{a:b}}, if it is a pseudo namespace you need to use {{:a:b}}.--Patrick 07:42, 25 July 2006 (UTC)

Default Templates

Are the default pages for 'discussion', 'edit', 'history', etc. templates?
And if so, what are their names (or how would I go about finding out their names by myself)?

Search e.g. for the content "discussion" in Special:Allmessages. It is in MediaWiki:Talk--Patrick 00:53, 26 July 2006 (UTC)
So the template name for the discussion page would be 'Talk'? But if I try to call up "Template:Talk" I get nothing.
Also, on my site I don't get any hits if I search for "discussion". --Frescard
Template:Talk does not exist here either, it is a different pagename.--Patrick 23:52, 4 August 2006 (UTC)
It seems that the entries listed under Special:Allmessages are only for captions or messages, but not for the whole page (i.e. if I change then content of MediaWiki:Talk I'm only changing the tab label. I assume I have to look more into the "Skins" direction?
It is not clear what you want. For any page the default talk page is an empty page. Its skin is the same as that of other pages. However, you can specify CSS for each namespace, see Help:User_style#CSS_selectors.--Patrick 07:41, 7 August 2006 (UTC)

Templates, parameters and HTML

I don't understand how templates can be used with parameters. If the template is anything other than trivial, i.e, if it's got any HTML formatting or markup in it, template parameters don't get expanded. DavidJameson 17:44, 4 August 2006 (UTC)

Why tmplate doesn't work?

I downloaded the Italian articles dump and loaded it on my MySQL Db. Then I installed mediawiki but templates doesn't work properly

could someone help me, please?


Can a template list the pages in a category?

Is it possible to make a template which lists the pages in a certain category? e.g. we could call it catlist, such that {{catlist|Alternative building}} lists each article in that category.

This relates to a discussion at - the policy on that wiki is to use category pages as articles, so that below the article are listed the pages in the category. However, there are a couple of problems with this, and I'm hoping that some kind of template or other trick will help us do it in a more flexible way. If there isn't a way in standard MediaWiki, is there some sort of add-on or tweak we could use? Thanks --Singkong2005 14:32, 10 August 2006 (UTC)

In relation to this, is there is a way to "include" a Special page in either a template or page OR is there a programatic way of getting a list of Categories and/or Articles from a Category so that the list can either be iterated over or wholly added to a template/page. Thanks --Rotty 14:46, 13 October 2006 (UTC)
Help:Category#Category_intersection_and_in-page_display mentions some extensions allowing an in-page list of the pages in a category.--Patrick 23:51, 14 October 2006 (UTC)

Evaluation before transclusion workaround

Anyone know how to evaluate a variable before it's transcluded? If not, any workarounds for the example here? The template and example usage (I want the superscript letters to link directly to the transcluded page.) --J. J. 23:06, 18 August 2006 (UTC)

You can use Help:Substitution#Delayed_substitution in versemore, and "subst:" in the verse article.--Patrick 09:57, 19 August 2006 (UTC)
I see that you've jumped right in to Wikible. Thanks! Even after a few tests, I still can't seem to wrap my mind around the delayed substitution concept. Would you mind taking a look at it? --J. J. 16:31, 19 August 2006 (UTC)

Parse parameter values through call

I'm trying to do the following on my 1.6.8 wiki: pageA has a template tmpl1 that creates a link to tmpl2?call=pageA so this template (tmpl2) knows what page called him. Is this possible??? --GrandiJoos 17:28, 19 August 2006 (UTC)

tmpl2 can use variable PAGENAME, which on pageA evaluates to pageA.--Patrick 17:54, 19 August 2006 (UTC)

broken links in IE and Opera again

I have following code in my template: <span class="plainlinks">[{{SERVER}}{{localurl:{{{Link}}}}} ext_img_ling]</span> and get: ..?title=%E2%80%8ELink Whats wrong with IE and Opera ? (FF seems to work) --Lastwebpage 15:55, 23 August 2006 (UTC)

I encountered that problem earlier. The code "%E2%80%8E" in a pagename is converted to the symbol "‎" which is, perhaps depending on settings, invisible on the rendered page, while in the edit window it is only noticeable when moving the edit cursor along the line, by being stationary one step.
For example "li%E2%80%8Enk" represents "li‎nk" with the symbol between the i and the n.
In a link we get li‎nk andcompare the normal link.
Following the two links we get in both cases
When copying the symbol to the address bar we get (in IE) a symbol somewhat like Γ with a vertical bar at the upper right end added. This symbol comes through the next one. On a link the hover box also shows this symbol. If the symbol is in a page title on the address bar, then when going to the URL-address the symbol is converted to %E2%80%8E again.
When copying the symbol to Word it is again invisible, but the stationarity property is preserved. In Scratchpad a box is shown.
Thus knowing how to detect the code you can delete it.--Patrick 00:04, 24 August 2006 (UTC)
Sorry, i am not sure what you mean with "detect and delete it" ? --Lastwebpage 01:11, 24 August 2006 (UTC)
For example li‎nk has the invisible code between i and n. In the edit box it is only noticeable when moving the edit cursor along the line, by being stationary one step. You can move the cursor to after the code and press backspace to delete it.--Patrick 09:16, 24 August 2006 (UTC)
Thanks, works :) --Lastwebpage 09:40, 24 August 2006 (UTC)

Calling templates from template parameters / parameter escaping

I'd like to call one template from the parameter of another. Something like:

{{note|blah blah blah {{bug|1234}} blah blah blah}}

Unfortunately, this seems to parse as:

  • note parameter 1: blah blah blah {{bug
  • note parameter 2: 1234
  • junk after note: blah blah blah}}

Is there a way to pass this parameter? As is, it needs some sort of escaping, but <nowiki> is overkill - it escapes it all the way through the template. -Slamb

That parsing works fine here:
but in your example, if applied here on Meta, you seem to be putting a link in a link target.--Patrick 23:26, 13 September 2006 (UTC)
I did this on my own installation. Thanks for pointing that out. I'm running 1.5.8; meta's running 1.8alpha (r16505). I'll look over release notes between. -Slamb 23:59, 13 September 2006 (UTC)
If I add definitions for Template:T (minus the default value, which doesn't work) and Template:X2, my wiki renders that as a{{ta{{tb}}. From the release notes, the most likely suspect seems to be the introduction of default values in 1.6. Anyway, what's the policy of this page -, or what? -Slamb 00:41, 14 September 2006 (UTC)
Ideally older versions which are still in use are also documented, but it depends on how interested editors are in particular versions. An editor who mainly uses the latest version may lose interest in, or forget, how things worked in various older versions, and it is more cumbersome to try things out (go to a site with that version).--Patrick 08:54, 14 September 2006 (UTC)

The Capacity Template

After the next donations, a new template will be created on the top of every pages in Wikimedia, when it goes below the level where problems can occur, it will read Wikimedia is running at 95% capacity on the top and will be posted even when signed in. It will be posted at any capacity. The template will be read as {{Capacity}} Pumpie 22:50 8 Oct 2006 (UTC)

Headline in Template

I'm trying to create a template, which consists of a table with a headline inside (and some other stuff, but they are irrelevant right now). I have no problem with the headline itself, but what I want is to be able to add to the section inside the table, by pressing on the "edit" part of the headline, much like you can add to a section of a regular article by pressing the "edit" part of that headline/section. Here's the problem. Instead of staying on the page, where I place the template, and add there, it tries to edit that section of the actual Template. This may sound confusing, so here's a visual. I wan't to add text to the "votes for"-part, but without editing the actual template, which it does whenever I place the template somewhere and then press the edit link (see here for example of this). Is there any way I can do that (add the text)? Help is greatly appriciated -- 01:30, 17 October 2006 (UTC)

It seems you mean editing a template parameter. This is done by editing the section with the template call, not the section where the parameter is used. See also the bottom of Help:Section#Editing_sections_of_included_templates.--Patrick 12:57, 17 October 2006 (UTC)
We figured out an alternative solution. I may not be overly pretty, but it's effective. Thanks anyway. -- 18:48, 17 October 2006 (UTC)

Passing variables... variably?

I need a bit of help. I'm trying to create a template that basically will list every variable I pass, only. I.e.:


Will output something like 3 rows of text, as in:

  • Foo-template-output var1
  • Foo-template-output var2
  • Foo-template-output var3

But will scale--so, if I add only one variable, I get only one line of output; if I add 20 variables, I get 20 lines of output. Is this possible? I was experimenting with this last night but got lost trying to get it right. If you can provide just a barebones, working example of this, I can go crazy with it--it really doesn't need to be super fancy; just output the same basic text string around my variables. XP 15:05, 25 October 2006 (UTC)

Displaying templates without categorizing

I have a few templates which automatically add the page to a category. I'd like to show a templates (like on a user page, or a project page) without adding the page to the cat. What's the best way to do this?

I went to the template page and "edited" it, copied the text, and pasted it, removing the category link, but the formatting wasn't quite correct. I can do it this way if I need to, but I was hoping there was a better way. Any suggestions? - 05:24, 28 October 2006 (UTC)

With #if and NAMESPACE you can add the page including the template depending on the namespace it is in. Or you can add a parameter with a default such that depending on it being defined, and if so, on its value, the page with the template call is put in a category.--Patrick 15:46, 28 October 2006 (UTC)
Okay, but I don't really want to change the template itself. Any other suggetions? 16:34, 28 October 2006 (UTC)
I just learned about subst: on Wikipedia, but that ends up putting kilobytes of text on the page. I don't like that solution either. 16:50, 28 October 2006 (UTC)

Having a template take an arbitrary number of inputs

I'm from the English Wikipedia, and our WikiProject Ships uses templates to create infoboxes on ship articles. An example of the use of our Infobox Ship template can be found here. A problem I'm running into is that a ship may have been decommissioned and then recommissioned many times, and I'm wondering if there's a way to handle this in the template instead of substing it and manually adding the extra decom/recom dates. I just added "Ship recommissioned" and "Ship decommissioned 2" variables to the template to support one decom->recom->decom, but I was wondering if there was a way to support any number of recommissionings. Is there a way to pass multiple values for "Ship decommissioned" into a template and have it handle them appropriately? Thanks in advance! TomTheHand 16:00, 8 November 2006 (UTC)

Template Recursion problem

I have a template, Wikia:ChristianMusic:Template:Box Set Indexer Test, that calls Wikia:ChristianMusic:Template:Box Set Indexer Test/Volume Cell. This second template should recurse. It calls itself, but with no parameters. Clearly, the template is passing the parameters, but the second copy acts as though there are no passed parameters.

Could someone explain why I am having a problem and how to get around it? I don't care if the final version uses recursion or not. All I want is to have X cells in that row where X changes for each page. I can't use simply X calls as that introduces extra whitespace where template calls evaluate to nothing. Because of Wiki table syntax, I must start each new cell on a new line. This is because the Wikia:ChristianMusic:Template:Box Set Indexer Test/Volume Cell can't assume whether the current cell is the first or not. So I can't just use a double pipe. The people at Wikia tell me that Winter is not an option due to stability concerns. If Winter were available, I would just use a FOR loop.

I have a second version at Wikia:ChristianMusic:Template:Box Set Indexer. It does with out the recursion without introducing extra whitespace by attempting to use HTML table syntax. However, for some reason, some of the cells are ignored. I don't know why. It causes major formatting problems.

As noted above, I don't care about the final implementation. As long as it works. Will (Talk - contribs) 09:25, 9 November 2006 (UTC)

I am still having problems with this. However, I should note that many Wikipedia templates (and some of mine at Christian Music) include a sample of the template on the template's page. Those work correctly. So why am I having problems in a non-sample situation? Will (Talk - contribs) 18:59, 13 December 2006 (UTC)

Building a Table using Templates: XHTML vs. piped

I have a table I built using a TableRow template that was similar to {{{field1}}}|{{{field2}}}, which I was calling using |-|{{TableRow|field1=mydata|field2=myotherdata}} . All good, but I wanted to convert to sorttable, so I changed the template to XHTML table code and then the tags from the template stop being interpreted. I didn't see anything in the restrictions about how this would work, and obviously it can work (with the piped tables). Am I doing something wrong in my templates? Sorry I can't show you all, the page is on an internal website.--MCroft 18:15, 16 November 2006 (UTC)

Perhaps you and I should get together. See my topic above. I have been having problems with recursive templates. After a while, I gave up on recursion. However, then I ended up with extra blank space in my cells unless I abandoned the Wiki table syntax. But the HTML syntax was being partially ignored. Will (Talk - contribs) 02:04, 17 November 2006 (UTC)

different content depending on parametre value

I'm building a where I would like to have one of those nice #if-tricks. The template has a variable "aspect" and it should print out the value (perfective or imperfecitve) in one place and the other one in another place. So {{example|aspect=imperfective}} would result in:


And {{example|aspect=perfective}} would result in:


I just don't know how to do it? In template example:

{| class="prettytable"
|'''please fill in this'''

-Samulili 11:26, 18 November 2006 (UTC)

Patrick 00:15, 19 November 2006 (UTC)
Thanks! So I guess it's like this?
if aspect = "perfective"
  then write "imperfective"
else write "perfective"
-Samulili 18:51, 19 November 2006 (UTC)
Yes, that's what it means.--Patrick 00:46, 20 November 2006 (UTC)

simple conditional syntax

I'm trying to do a simple conditional check and I don't understand why it's not working

I'm calling my template with {{usecase|number=3}} and the usecase template definition is:

Use Case: {{#if:{{{number}}}|{{{number}}}}}

I basically only want to display the number if it is given, and display nothing if not. Anyway, this is the result:

Use Case {{#if:3|3}}

I must be completely dense to not get something this simple working. Reacher

Does {{#if:3|3}} by itself work? If not, ParserFunctions may not have been installed. Anyway, to display the number if it is given, and display nothing if not, you can simply use {{{number|}}}, see Help:Parameter default.--Patrick 23:56, 13 December 2006 (UTC)

Multiple images as parameter

I want to be able to have someone insert an arbitrary number of images. All I want them to have to type in is the filename (not the full path) of the image they want to insert. So for instance if I have two images asclepias_tuberosa.jpg and psoralea_esculenta.jpg. All I want them to have to type in when they are creating a new page is something like:

more options =

and then have the template automatically put both of those names into this format [[Image:{{{photo}}}|200px]]. Once again, I need this done for any number of pictures, not just one or two. How can I make something that can process however many they put in?

Thanks, jt

Perhaps something like that can be done with Template:for [ talk edit history links ], and an extra template to convert the image name to the image tag. Anyway the image names would be separate parameters, so separated by "|", unless you use the gallery tag.--Patrick 08:41, 26 December 2006 (UTC)

Using gallery tag in templates doesn't render any output

Why wont this work?


Very weird. I'm on 1.82. Any ideas? Rune.

It is mentioned in Help:Template#When_parameters_do_not_expand.--Patrick 01:41, 24 January 2007 (UTC)

Harmonization with Wikipedia

I have been making some changes to harmonize this version with the one on Wikipedia, to remove redlinks, and to make both work and function effectively without disrupting either project any more than is absolutely necessary. I have had to do this in a variety of ways. More changing to t2demo needs to be done. I'm not done, I just have to go. -- Jeff G. AKA 17:46, 11 February 2007 (UTC)

Re:"not all projects (including Wikipedia) support underscore in template names": they do, it is identified with a blank space. The underscores on Meta were not needed, to clean up you could have just replaced them with a blank space without changing the template.--Patrick 00:00, 12 February 2007 (UTC)

Template help

Hi, wonder if anyone can help. I created en:Template:Infobox monastery, and tried to make it work on en:Melrose Abbey; however, it won't work, and despite spending much time, can't figure out what it is that's wrong. Wonder if anyone can help. Regards, Calgacus 22:13, 14 February 2007 (UTC)

Fixed.--Patrick 01:06, 15 February 2007 (UTC)

Getting Parameters Out of Other Templates

Can I do this?

1. Define parameters Template:Store name and Template:Pricing.

2. Grab parameters Template:Store hours from another page, Store_Name (coincidentally created by a template).

3. Make a table from a template using variables Template:Store name, Template:Store hours, and Template:Pricing.

I just want to display the store_hours data without creating a duplicate.

Brando 15:59, 2 March 2007 (UTC)

I would not try to grab store hours from Store_Name, but you can use Template:Store_hours both in Store_name and in a table on another page.--Patrick 00:31, 3 March 2007 (UTC)

question about includeonly tags in boilerplate

I want to have boilerplate text for a template, inserted using the preload parameter. The boilerplate needs to contain includeonly tags. But these don't show up in the preload; their content does, and both the noinclude tags and their content, but not the incluedonly tags themselves.

Is there some way around this? --Starwed 03:37, 13 March 2007 (UTC)

I found a workaround, using delayed substitution, which pretty much achieves this:
  • Create a template named includeonly consisting of the word, includeonly.
  • In the boilerplate text, instead of the <includeonly> tag, use <{{<includeonly>subst:</includeonly>includeonly}}>. When the text is copied into an edit box, it will appear as <{{subst:includeonly}}>, and then when the page is saved, it will be simply <includeonly>.
--Starwed 04:38, 16 March 2007 (UTC)

Isolating Link Text

Is there a convenient mechanic for taking a parameter containing links and stripping it down to just the text? E.g. from:


  • some link
  • some other link
  • another link followed by yet another link

Sledged (talk) 00:56, 26 March 2007 (UTC)

"Object-oriented" Approach to Templates / Multilevel Nesting Templates & Parameters

What I've got on mind, and I'm already tinkering with it, is a some kind of object-oriented approach to templates.

Take for example resumee, which consists of several, different sections, such as personal informations, contact informations, education, career, interests, etc. For all those sections I'm creating appropriate templates (TplPersInfo, TplContInfo, etc.) on their own, and everyone having its own set of (named) parameters, so that I can reuse them individualle whenever and wherever I like to.

All those single, individual templates are then combined into one big Master Template, which then is called from a "regular" wiki page. So, and this is exactly where my path leads from the sunny side into the shadows. How to provide the parameters for all those included sub-templates to my master template (e.g. FirstName and LastName for Personal Informations; Address and Country for Contact Informations; etc.)? 20:24, 4 June 2007 (UTC)

  • Do you mean something like putting "FirstName={{{FirstName}}}" on every template? Hillgentleman 21:47, 4 June 2007 (UTC)
  • I'm not quite sure if I'm catching your point properly. :( Best would be, I'm adding my template definitions below:

Template:Personal Data Personal (Sub-Template)

== Personal Informations ==
{| border="0" cellspacing="1" callpadding="20"
! align="right" style="background-color:LightGray;" | Salutation
! align="right" style="background-color:LightGray;" | Title
! align="right" style="background-color:LightGray;" | First Name
! align="right" style="background-color:LightGray;" | Middle Name
! align="right" style="background-color:LightGray;" | Last Name
! align="right" style="background-color:LightGray;" | Gender
! align="right" style="background-color:LightGray;" | Date of Birth
! align="right" style="background-color:LightGray;" | Nationality
! align="right" style="background-color:LightGray;" | Marital Status
! align="right" style="background-color:LightGray;" | Confession

[[Category:Personal Informations]]

[[Category:Personal Informations Template]]

Template:Personal Data Contact (Sub-Template)

== Contact Informations ==
{| border="0" cellspacing="1" callpadding="20"
! align="right" style="background-color:LightGray;" | Address
! align="right" style="background-color:LightGray;" | P.O. Box
! align="right" style="background-color:LightGray;" | Zip
! align="right" style="background-color:LightGray;" | City
! align="right" style="background-color:LightGray;" | State
! align="right" style="background-color:LightGray;" | Country
! align="right" style="background-color:LightGray;" | Phone
! align="right" style="background-color:LightGray;" | Mobile Phone
! align="right" style="background-color:LightGray;" | Fax
! align="right" style="background-color:LightGray;" | eM@il
! align="right" style="background-color:LightGray;" | Home Page
! align="right" style="background-color:LightGray;" | Skype

[[Category:Contact Informations]]

[[Category:Contact Informations Template]]

Template:Personal Data Combined (Master Template)

{{Personal Data Personal}}
{{Personal Data Contact}}

[[Category:Personal Data]]

[[Category:Personal Data Combined Template]]
  • If you are going to call the master template by
{{personal data combined|address=adfgfgh|Name=anldfnh| etc=bla}}

Then the master template should be

{{Personal Data Personal|name={{{name|}}}| address={{{address|}}}| etc={{{etc|}}} }}
{{Personal Data Contact|name={{{name|}}}| address={{{address|}}}| etc={{{etc|}}}}}

[[Category:Personal Data]]

[[Category:Personal Data Combined Template]]

-Hillgentleman23:05, 4 June 2007 (UTC)

Perfect! :) 04:48, 5 June 2007 (UTC)

Equals signs in template parameters

It appears that equals signs cannot be used in template parameters. If you do, the parameter is ignored. Why is this? Is there a way to get them to work? I don't monitor this page, so respond at Pi = 3.1415926535.

See Help:Template#Equals_sign_in_parameter_value.--Patrick (talk) 07:29, 1 August 2007 (UTC)


A cleanup tag has been placed on this page, but it seems to be okay to me... AnonymousDissident 08:25, 2 September 2007 (UTC)

I did not place the clean-up tag but I agree with whoever did, this page is not well organized and not very well written for the sake of instructing on how to use templates. The best example I can give is in the General section


  • if a page is conditionally embedded through #if, #ifeq, #ifexist, #ifexpr, or #switch, it is counted as embedded, even if the condition is not fulfilled
  • if the name of an embedded page is an expression, e.g. {{abc{{CURRENTDAY}}}}, currently giving Template:Abc22, the current template name is shown.

Thus, to use "What links here" to find the pages that actually embed template A, instead of using e.g.


one has to use an alternative, e.g., duplicating the condition:


or, using Template:Echo:


Only with the first of the two alternatives "What links here" also finds the pages that actually embed template B. In the second alternative the page is anyway considered embedded. If we replace "b" by "{{if:1|b}}" the page is never considered embedded.

(Supported in version 1.4 and higher.) "

Huh? Too many new and unfamiliar concepts introduced similtaneously!
This bit of instruction might as well have been written in hiragana on the dark side of the moon. Look at the Parser_functions page for a somewhat better organization. Some examples on the Help:Template page were better understood on the Parser_Function page even though that was not the intent. Manual writters everywhere should be familiar with the acronym KISS.
Well, since certain template contructs are prone to being complex, then it seems natural the explaination be complex as well... AnonymousDissident 21:51, 14 September 2007 (UTC)
This is a reference-style manual. The question of whether a template is considered transcluded on a page is, even for advanced cases, treated before treating parameters. Having in addition tutorial-style and/or simplified pages can be useful. We currently have Help:A quick guide to templates and mw:Help:Templates.--Patrick (talk) 01:24, 15 September 2007 (UTC)

I also did not place the clean-up tag, but think this page needs an urgent clean-up. It has no structure and makes no sense to someone who does not know what it is talking about. I suggest the following sections: Overview/Introduction, 2 Minute Tutorial, Advanced Template Usage, Template Reference. The Tutorial should include lots of examples. -- 02:18, 4 October 2007 (UTC)

carriage return issue affecting templates

I just installed mediawiki 1.11.0 and I'm having a baffling issue with templates. I'm used to being able to arrange template parameters into an easy to read form to be filled out like:

parameter1  =x
parameter2  =xx
parameter3  =xxx

Unfortunately this makes the template work at all and just places the following instead:

{{foo parameter1=x parameter2=xx parameter3=xxx}}

I'm so frustrated because the forms style make complicated templates so easy to use. Can somebody help me. Is there something I need to change in localsettings to change how it treats new lines? --Metal.lunchbox 05:05, 15 November 2007 (UTC)

The "|" are missing.--Patrick (talk) 13:25, 15 November 2007 (UTC)

Help with presumably trivial template issue

Hi there. On English Wikipedia I've created a template called Template:How Long Ago, which has one or two issues (see the talk page). It's adapted from Template:User Wikipedian For. Any help with its carriage return problem would be appreciated - it would take someone other than me around two seconds to solve. Additionally, if the template I've made is redundant because something like it already exists, could you let me know? Cheers - Gobeirne 10:43, 21 November 2007 (UTC)

Done.--Patrick (talk) 10:57, 21 November 2007 (UTC)

Templates copied from Wikipedia not rendering correctly

This is so frustrating. I copied the article Rehoboam from Wikipedia to my wiki (offline) as a sample to see if I could get the templates working.

{{bibleverse-lb|1|Kings|12:1-14|HE}} came out as:

[[{{#if:1|1|Book of}} Kings|{{#if:1|1 }}Kings]] 12:1-14

And the succession table at the bottom is a huge mess. For example, what should read this:

Preceded by Solomon

Reads like this:

Preceded by Solomon{{#if:| as {{{as}}}}}

I've been copying the templates, and the templates used in those templates, and so on, but it really seems that it's the {{#if syntax that's not being recognized properly. Is there an obvious issue that I'm missing? I'm using MediaWiki 1.9.2. Thanks for any help! -LisaLiel 18:40, 30 November 2007 (UTC)

Install the extension ParserFunctions.--Patrick (talk) 01:43, 1 December 2007 (UTC)
Thanks, Patrick. But now I have a different issue. The installation instructions say to put this line at the bottom of my LocalSettings.php file:
I assumed that by "at the bottom", it means before the final ?>. When I do that, nothing displays at all. The entire window is blank. When I tried moving it below the ?> (just in case), it changed the font of the whole page, and printed that line at the top of the page, but other than that, it didn't start parsing.
Is there something I'm missing? -LisaLiel 23:27, 1 December 2007 (UTC)
PS, I'm using PHP 5. -LisaLiel 23:29, 1 December 2007 (UTC)
PPS, I did download ExtensionFunctions.php from SVN, and put it in the extensions folder. -LisaLiel 00:51, 2 December 2007 (UTC)
PPPS, I went and got updated ParserFunctions files, and now it's working. Thanks for your help! -LisaLiel 00:58, 2 December 2007 (UTC)

Borders missing in tables

All of my wikitables are missing borders. Is there some extension that I need to install to make them appear correctly? The wikitable class defaults to borders and shading on Wikipedia and other MediaWiki sites, but I don't seem to have that style sheet. Thanks. -LisaLiel 15:48, 3 December 2007 (UTC)

Never mind. -LisaLiel 16:03, 3 December 2007 (UTC)
Return to "Template/2007" page.