Help talk:Templates

Examples of each usage would be extremely helpful - Will the WikiWise please provide some? Thanks! —The preceding unsigned comment was added by 24.108.13.171 (talk • contribs) 23:04, 25 November 2006.

Namespaces
Should the fact that any page can be used as a template be mentioned, or should it remain undocumented magic? -- Duesentrieb 16:35, 16 January 2007 (UTC)

I did see that mentioned someplace just a second ago. Martin | talk • contribs 22:13, 22 February 2007 (UTC)

Confused
Ok I cant seem to work out how this thing works at all, I try and copy and paste the code here and it dont work. what am i doing wrong?

Thats what I put for a test template and all i get is the title come up Object

Any ideas

Re:Confused
Templates works only as transformation. In your wiki you have to create Template:Object page if you want to use template named Object, try something more simple as first template.

I think this help is well understandable. Maybe another example will be good for you.

In your wiki edit page www.yourdomain.com/wiki/Template:first Write there something like: Your first argument: Your second argument:

save the page (stop editing)

somewhere in your wiki edit some another page and insert here code: It was not working without 1= and 2= for me in wiki 1.9.3 (bug)

when you try preview now, you will see: Your first argument:text1 Your second argument:text2

I hope it's clear now, from template page will be replaced with everything what is after 1=

--Betlista 17:53, 17 May 2007 (UTC)

Templates with/for images
How would I create a template where I pass only the name of an image (e.g. 'picture01.png'), and within the template this name is transformed into something like ?

Going one step further, I want to do it the 'Semantic MediaWiki' way, ie. again pass only the name of the image, and the template does the rest, ie.


 * assign the parameter ( ImageName:= )
 * expand this to [[Image:[[ImageName:=]]|150px|]]

Unfortunately like this it doesn't work. 85.125.230.177 15:53, 13 June 2007 (UTC)

Templates inside parameters
At my wiki I have a template called Shape and a template called R strange. The original intention was to put inside the Shape template, but writing  doesn't work, rather it makes it be interpreted as. Is there any way to nest templates like this?

If not, I'll likely have to do some crazy positioning stuff with CSS.

- Keiji 82.32.169.78 16:37, 18 June 2007 (UTC)

Never mind, I got it to work.

- Keiji 82.32.169.78 16:57, 18 June 2007 (UTC)
 * How??? Slamlander 05:31, 25 October 2007 (UTC)

Some help?
Can anyone explain to me why this code produces bold text? I can't figure it out. Thanks in advance.

--67.84.103.128 00:38, 24 June 2007 (UTC)


 * It's because of the "!" at the beginning of that line. Replace it with "|" and you'll be happy ;-)
 * In addition you have to replace the "=" within "text-align=center" with ":" – otherwise it won't have any effect. -- :Bdk: 01:03, 24 June 2007 (UTC)
 * Thanks a lot for the help, but why is it that a ! instead of a | makes it bold? --67.84.103.128 01:15, 24 June 2007 (UTC)
 * See Help:Tables. -- :Bdk: 01:42, 24 June 2007 (UTC)
 * Thanks again. Not sure what the rules are on this particular wiki about deleting, so I don't want to delete this topic myself, but I go the info I needed. --67.84.103.128 02:02, 24 June 2007 (UTC)

Default templates?
Is it possible to create a template that is instantiated automatically without the user's intervention?

I've got a family wiki that many people edit. I'd like pages created from one particular page to all automatically start with a template. It's a collection of recipes. The procedure is to add the name to that page. When they link to the new page, I'd like it to automatically start with a default recipe format...

Thanks! (twinotter) 165.219.245.62 19:12, 10 July 2007 (UTC)
 * That goes beyond templates and into boilerplates, or parameterized templates. Using templates this way actually makes your pages harder for your users to edit. At that point, you might be better off with a specialized PHP page. My recommendation is to do a standard page header template and show your users how to use it. -Slamlander 05:23, 25 October 2007 (UTC)

Quick installer, perhaps?
If one were to install MediaWiki on their server, is there a chance there's an installer that comes with a bunch of templates? If so, a link to such a program would be nice. - Ahren 1:46 EST

Optional Fields?
As my question pertains to template use, I suppose this is where it goes. Is there a code for optional fields in a template? For example (Code I use is below): Say I want it set so that rank does not appear, if the field is not filled in, how does one do that? Thanks for any help someone can give.

First, make sure you have the parser functions [] installed and working. Then you can do the following; Give that a try and let us know if you got it working =)
 * Rank:
 * Rank:

Infobox class??
I've just installed my first wiki - 1.10.1 and trying to setup some Infobox templates. The problem is there seems to be no Infobox class defined anymore? The various files I find online that have it, such as monobook.css and common.css seem to be competely different to the css files in the 1.10.1 package. I'm guessing something has changed quite dramatically in recent versions? What am I missing? --DJS68 02:09, 1 September 2007 (UTC)
 * I'm not a PHP programmer, but this line doesn't look right in monobook.php -


 * /*<![CDATA[*/ @import "text('stylepath') ?>/text('stylename') ?>/main.css?"; /*]]>*/
 * --DJS68 02:29, 1 September 2007 (UTC)
 * nope that's not the problem :-( --DJS68 02:37, 1 September 2007 (UTC)

Templates Outside the Template Namespace
I just felt like sharing this:
 * Any page that has data in it can be used as if it were a template. Just enclose the page title in double curlies like so:
 * This would import expand this page into on whatever page you were editing.
 * A special addition needs to be made if you are trying to use a page from the "(Main)" namespace since a call to:
 * is equivalent to a call to:
 * If the page you want to use as a template is in the "(Main)" namespace, you must precede the page name with a colon like this:
 * is equivalent to a call to:
 * If the page you want to use as a template is in the "(Main)" namespace, you must precede the page name with a colon like this:
 * If the page you want to use as a template is in the "(Main)" namespace, you must precede the page name with a colon like this:

My apologies if this has already been discussed elsewhere.

Template Migration
I have a number of wiki's that I maintain and I want the same templates on all of them. How do I replicate the whole batch (about 36 of them) in one go?
 * - Slamlander 05:37, 25 October 2007 (UTC)
 * Use Special:Export and Special:Import. Or you could try remote transclusion. Jlerner 18:45, 16 November 2007 (UTC)

Templates Args
Any best practices advice or example for dealing with unnamed template parameters? And possibly mixed ones? I would like to be able to write a template like this the following. And easily access the unnamed parameters. Using the variable and control structure extensions to for/while loop through the } to manufacture a "argv[]/argc" was the best I can come up with, but it seems to be a pretty intensive.

Thanks --Gmillerd 10:44, 26 November 2007 (UTC)

Template Overload
Hi there, I have got a question: We have some templates which we use A LOT, even A LOT on one single page. It has an ID as parameter and outputs an icon + a text. The software stops converting the templates at some point and this is kinda anoying. anyone with ideas for that? or can we change the "max templates"-value? maybe someone could even add this pint to the article. greets, 79.193.229.90 15:28, 24 January 2008 (UTC)

How do the Wikipedia Template: Cite book and Template: Cite work?
I'd like this in conjunction with my wiki page... but currently I can't figure out the implementation.--66.214.128.163 17:08, 2 February 2008 (UTC)


 * Hmmm wikipedia:Template:Cite and wikipedia:Template:Cite book hey? Use the 'view source' tab to see their wiki text.
 * You should just be able to create a page called "Template:cite" on your own wiki and put in the follow wikitext:
 *  , , ,  .  


 * ...to get a similar effect. I've missed of the 'noinclude' documentation section which is not necessary, and makes it more complicated. (it uses another template "wikipedia:Template:Documentation" to transclude documentation from a sub-page)


 * Now the 'Cite book' template is more tricky. I think it's using a parser extension. Probably Extension:Cite/Special:Cite.php, which you would have to install on your wiki, if you wanted it to work in exactly the same way. You can probably think of a more simplistic way of acheiving what you need though.
 * Templates on wikipedia tend to be rather more complicated than they need to be, and certainly not designed to make it easy to copy them. I was thinking actually we could kick off a project similar to Project:PD help, but for supplying a simple bunch of standard tempates for a new wiki installation.
 * -- Harry Wood 11:15, 4 February 2008 (UTC)

Missing parameter
Let's say i define 2 parameters. When only 1 is called it will display. Is there a way to let it fall back to and call in such cases? --Subfader 20:04, 29 February 2008 (UTC)
 * --Egingell 16:44, 1 March 2008 (UTC)
 * Ok how to add it? I have the template: [[Media:|]] . Now without a defined param2 it should work like this: [[Media:|]] . --Subfader 09:57, 28 March 2008 (UTC)

A parameter starting with a single "+" sign is not processed as expected
I wrote a template where a parameter holds a telephone number (its content looks like "+123 (456) 78901234"). If I type something like this: It's not processed correctly and the value is displayed on the wrong position. If I type something like this: The phone number is displayed the right way, but has the sorrounding quotes. How do I pass a parameter starting with a "+" sign to a template? Thanks --Major² 10:08, 31 March 2008 (UTC)
 * Please tell us what the template definition looks like -- Duesentrieb ⇌ 12:30, 31 March 2008 (UTC)
 * This is a really simple template used to display business card info within a table:


 * ––Major² 23:59, 31 March 2008 (UTC)