Help talk:Template/Archive 2

Advice wanted for template
I have created a template, but for some reason it needs to be substd - otherwise if I put it on a user's page and they edit, it goes to the template page for editing! How can I amend the template so that it doesn't need to be subst'd?

The template is and an example of when I use it can be see at User:Phantomsteve/Test-bed for the un-subst'd version (if you click on "edit" for AfD for "test" article, then it goes to the template - I want to keep the header (I'm guessing that's where the problem lies)! User:Phantomsteve/Test-bed is where I substd it - if you click on edit for AfD for "test" article, then obviously it'll edit the text on the page.

I've used other templates with variables which do not need to be subst'd, but they don't use level headers.

Any advice on how I can use this template without subst'ing it (or if I can be told definitively that it can't be done without subst) I would appreciate! --  Phantom Steve  ( Contact Me, My Contribs ) 12:20, 20 August 2009 (UTC)
 * I believe it is fixed. Note left at your talk.--Fuhghettaboutit (talk) 00:10, 27 August 2009 (UTC)

Help required
I have created template:lfc, to do a similar thing to template:fc when writing fotball club names. As women's football clubs, in the UK anyway, are usually Clubname Ladies, while their official and wiki names will be Clubname L.F.C. I'd like the template to also add 'Ladies' after the Clubname.

So for example, if I type Arsenal, at the moment the template will give me Arsenal , which is almost right, except I want it to give me Arsenal Ladies. Am a novice at this, so apologies if this is a really basic question, but hopefully someone can either show me how to do this, or just fix the template for me.

Thanks, 8lgm (talk) 16:18, 21 August 2009 (UTC)


 * Proof, I'm a novice I guess... My attempt is about to be speedy deleted as template:Lfc already exists and does the'almost there' bit. Would still like a further template to add the Ladies bit afterwards though. 8lgm (talk) 16:21, 21 August 2009 (UTC)

Conditional statements inside math equations
I have posted a question at WT:MSM about a new template I am trying to get up and running: Template:DentalFormula. It involves the use of conditional statements inside $$...$$ statements. I would appreciate some advice. Thanks! –Visionholder (talk) 18:05, 15 September 2009 (UTC)
 * The problem has been fixed, thanks to a suggestion at MediaWiki –Visionholder (talk) 08:43, 16 September 2009 (UTC)

How do I get my signature to automatically expand in a subst:ed template?
I want to be able to subst a template and have it insert my live signature. However, if I put the code: ~, I end up with an expanded signature saved in the template itself, which is then carbon copied when I subst: the template. How can I make it actually sign for me? Does the question make sense? -GTBacchus(talk) 09:49, 17 September 2009 (UTC)

Never mind, I just figured it out. I need to use:

-GTBacchus(talk) 09:53, 17 September 2009 (UTC)
 * The simplest solution is:

Ruslik_ Zero 15:06, 21 September 2009 (UTC)

Template to mimic piped magicword
Hi all - I need some help with finding some way to mimic piping in. Is there any way either to use the magoc word or to create a template which mimics it so that it works in the same way as the pipe trick for article names?

For instance, say I wanted to start standardised stubs about small towns with the following titles... ...and wanted to have all of them start with the text:Xxxtown is a town in Flubbistan.
 * Xxxtown
 * Xxxtown, Foo Province
 * Xxxtown, Bar Province
 * Xxxtown, Snert Province

Towns without disambiguators, I could simply use PAGENAME; disambiguated names I'd need to find some way to stop the province name appearing in the article. Is there any way that PAGENAME can do that, and if not, how would I go about creating a template to do it? Grutness... wha?   08:18, 18 September 2009 (UTC)


 * I don't entirely follow what you are trying to do. If you feed the Xxxx to the template, you can always append the "town, Bar Province", and set up the piping that way.  If you feed in the full name, then it's basically not possible to just grab the first part.  When I say basically not possible, I mean without using some deprecated and less than reliable tricks. Plastikspork ―Œ (talk)  20:57, 18 September 2009 (UTC)
 * It's the second thing I'd like to do. To put this in context, someone recently used a bot to create 800 articles on rivers in New Zealand. Some of them are simply in the form "Foo River", others - where dabbing is needed- are in the form "Foo River, New Zealand". I was wanting to "boilerplate" some standard information onto all of them, but can't use PAGENAME unless I then re-edit any with the disambiguator in the title. I was just looking for any way round that. If there isn't one, that's fine, I was just trying to save myself some work. Grutness...  wha?   23:48, 18 September 2009 (UTC)
 * Are you trying to create a page with links to all of these articles, and you want to have piped versions for the ones which end in ", New Zealand"? If you point me to a page with all the links, I can run a script to pipe them all when necessary. Plastikspork ―Œ (talk)  19:11, 19 September 2009 (UTC)
 * No - as I explained, I'm trying to replace the current text of the articles (one plain sentence: "The PAGENAME is a river of New Zealand") with a more detailed paragraph which reads "The   is located in xx Region, in the xx Island of New Zealand. It runs xxdirection to reach the xxriver xx kilometres xxdirection of xx." It's easy enough to change the xxs before saving the article, as well as making any other necessary additions, but if the page title is disambiguated I need to save and reopen the edit window to change the piped name to the correct name. Grutness...  wha?   22:06, 19 September 2009 (UTC)
 * I found Template:Title disambig text, which is kind of the reverse of what you want. I can't find something that automatically removes the disambig tag rather than extracting it, but you can cobble something together quite easily from Template:Str find and the other templates in that category. (Or I can run a script for you, if you supply me with all the data.)--Kotniski (talk) 15:32, 21 September 2009 (UTC)
 * I agree that the best solution is probably to run a script on all transclusions. The problem with templates like 'str find' is they aren't the most robust. Plastikspork ―Œ (talk)  15:39, 21 September 2009 (UTC)
 * I was thinking they'd be OK for subst'ing, though of course that's another problem; you'd have to define subst'ing versions of any subtemplates that are in use. Looks like it's a job best handled by a script.--Kotniski (talk) 15:43, 21 September 2009 (UTC)
 * Thanks for the help and suggestions. I think I'm probably far enough through the task that trying to cobble things together would probably be as much work as the task I'm trying to avoid, though, so I'll keep doing it by hand. Cheers, Grutness... wha?   00:33, 22 September 2009 (UTC)

Indentation question
Is there any way to make sure that a template keeps the current indentation?

For example, if I use, then all new lines within my-template are indented as per :: - and if I had a line in the template which was indented a level (e.g.  ) then it would be indented as if it was  ? --  Phantom Steve  ( Contact Me, My Contribs ) 14:31, 21 September 2009 (UTC)
 * I rather doubt that this is possible.--Kotniski (talk) 15:33, 21 September 2009 (UTC)
 * If you want to keep the same level of indentation, then don't add indentation in your template? If you want to breakout of some indentation, then add a newline? Plastikspork ―Œ (talk) 15:35, 21 September 2009 (UTC)
 * It seems the question is about keeping the level of indentation as defined outside the template as a starting point for the indentation of any new lines that occur within the template. People's ingenuity sometimes surprises me, but I would guess that you just can't do this.--Kotniski (talk) 15:39, 21 September 2009 (UTC)
 * It is possible, but you have to indent using a different mechanism. Basically, you use &lt;dl>  and &lt;dd> for the indentation. To get it perfectly right, just look at the resulting html from : and ::. Plastikspork ―Œ (talk)  16:21, 21 September 2009 (UTC)


 * Thanks for the replies! I thought it wasn't easily possible, but thought I'd ask! (Incidently, Kotniski understood what I was after!) Thanks --  Phantom Steve  ( Contact Me, My Contribs ) 17:41, 21 September 2009 (UTC)

Postscript - as I say, people's ingenuity surprises me (Plastikspork's in this case) - based on his suggestion, I seem to have got it working. (I can't imagine what this could be useful for, but still, good to know it can be done.) This is using User:Kotniski/Templatedemo:





At least, on my browser I'm seeing it right.--Kotniski (talk) 14:16, 23 September 2009 (UTC)


 * Thanks to Plastikspork and Kotniski! That works brilliantly! --  Phantom Steve  ( Contact Me, My Contribs ) 16:22, 23 September 2009 (UTC)

Other Template Languages
Is there any way to hook up a different language to process templates, like JVM/Scala or Python? Thanks. Mero son ox  t c g  21:50, 6 November 2009 (UTC)

Help needed with parameter as if/else variable
Hi - hope this is the right place to ask. I've just made a template NZYearbook to use in reference sections for articles referencing the New Zealand official yearbook. I've used the year of the yearbook (which is published annually) as a parameter, so that it returns "New Zealand official 1977 yearbook"" (or whichever year. I'm also trying to make that parameter act as a if/else variable - the yearbook's publisher up to 1994 was the New Zealand Department of Statistics, from 1995 on it was Statistics New Zealand. I can't seem to work out how to make the parameter use one of these if it's 1994 or under, and the other if it's 1995 or over. Any help would be gratefully appreciated, thanks in advance. Grutness... wha?   09:13, 14 November 2008 (UTC)


 * Fixed, I think. looks like you might have had a non-breaking space (or seomthing like that) gumming up the works.  -- Ludwigs 2  00:02, 29 December 2009 (UTC)

Collapse/Uncollapse Help Request
I'm not sure where to seek out help with this so I'll try it here: On the Contemporary Philosophy entry there are 3 templates so they all collapse by default. Does anyone have a suggested way to make it so that the Analytic Philosophy template and the Continental Philosophy template remain uncollapsed by default. - Atfyfe (talk) 05:09, 14 November 2009 (UTC)


 * I assume you mean Contemporary philosophy, and are referring to the navboxes at the bottom? just add state = uncollapsed to each of then to have them open at startup.  looks like

Fault-tolerant delimited list template?
Is there a template available that will create a delimited list out of its parameters, skipping any parameters that happen to be null? I've tried   and    but they both fail if the first parameter is null. For instance:

  produces the following:

Similarly,   produces nothing at all because it stops once it hits a null parameter, as shown below:

I'm trying to create a template that includes a comma-delimited list, and sometimes some of the elements of that list will be null (including the first item of the list). Any suggestions? Thanks! talk 22:04, 23 December 2009 (UTC)


 * I've updated do list so that it should work the way you want. -- Ludwigs 2  02:06, 24 December 2009 (UTC)
 * (edit) the problem, obviously, is that it includes a delimiter for the empty space, even on the first try. let me see if I can fix that. -- Ludwigs 2  02:08, 24 December 2009 (UTC) alright, that should be fixed.  -- Ludwigs 2  02:55, 24 December 2009 (UTC)


 * Wow great, thanks! I'll give it a try.     talk 23:04, 24 December 2009 (UTC)

Need some help with IF
Hello, I'd like to add a feature to add a feature to Infobox NFLactive but I'm not quite sure how to do it. That template chooses colors from certain templates—NFLPrimaryColor, NFLSecondaryColor, NFLAltPrimaryColor, and NFLAltSecondaryColor—based on the value of parameter currentteam. What I want is that for some teams (some values of currentteam ), that template does not use the alt color templates (NFLAltPrimaryColor and NFLAltSecondaryColor) but only the main color templates (NFLPrimaryColor, NFLSecondaryColor). Which means that those lines have to have an IF-THEN, I think. How would that look like in code? --bender235 (talk) 13:10, 28 December 2009 (UTC)


 * easiest way to do this is with a bit of a trick. create a parameter called (say) 'usealt', and rewrite the line above as follows, so that the name of the template called becomes a variable:

colspan="2" style="text-align:center; ;" | Personal information


 * with this, Infobox NFLactive - where usealt is omitted - will insert the default 'Alt' and make the template call read NFLAltPrimaryColor; using Infobox NFLactive will set usealt to the empty string, and make the template call read NFLPrimaryColor.


 * haven't actually tested it, but it should work.-- Ludwigs 2 14:41, 28 December 2009 (UTC)


 * I was already aware of the way, but I don't want to use it because it means we'd have to change a couple of hundreds of player profiles on Wikipedia. I wanted to do it by just changing one template (Infobox NFLactive that is), implementing some sort of a if-then construct. Do you have any idea how to do that? --bender235 (talk) 14:54, 28 December 2009 (UTC)


 * Okay, I have an idea now, but I'm not quite sure how to programm it. I could create a seperate template with a  function, that returns "Alt" or "" based on the input parameter (that would be currentteam ). Is that possible? --bender235 (talk) 23:16, 28 December 2009 (UTC)


 * Okay, I successfully programmed it on my own. This problem is solved. --bender235 (talk) 23:44, 28 December 2009 (UTC)

Creating and editing templates
In this section of the article is this pharse: "Some people suggest that template names be completely small caps..." Surely "lowercase" is meant, or conceivably "CAPITALS." Someone who knows, please fix. Phil wink (talk) 06:47, 5 January 2010 (UTC)


 * lol - will do. I only hope I wasn't dorky enough to have written that myself.   -- Ludwigs 2  08:04, 5 January 2010 (UTC)

Help with SUBSTing within a template
If you look at my welcome template User:Phantomsteve/welcome, you'll see that I have some user name warnings.

I have recently changed the warning templates to require SUBSTing, and tried to use to use these from within the welcome template (within an IF statement, as it depends on arguments), but when I try it, all I get is the text instead of it actually being SUBST'd (see User talk:Phantomsteve... how do I get it to work the way I want it to? --  Phantom Steve / talk &#124; contribs \ 11:25, 23 January 2010 (UTC)
 * If anyone is wondering why the SUSBT is required, it is so that the category (user names causing concern) can be removed - if the template is transcluded, that can't be removed (also, the template will show an error) --  Phantom Steve / talk &#124; contribs \ 13:35, 23 January 2010 (UTC)
 * If I understand correctly, you want the ability to suppress a category added by the template? There are some simple ways to do that. ---— Gadget850 (Ed)  talk 16:33, 23 January 2010 (UTC)
 * No, I want the category in the called template to be kept. I want the called template to be substituted from the welcome template, not transcluded. Hence why I used for that bit. --  Phantom Steve / talk &#124; contribs \ 16:38, 23 January 2010 (UTC)
 * When the company-name template is called, for example, then the category is added. However, when it was transcluded, the category can't easily be removed from the end-user-talk-page without removing the entire template. If it is subst'd, the category can be removed from the end-user-talk-page without removing the whole template. What I want is to be able to call the company-template from my welcome template - which requires it to be a "subst" call. if I use subst directly, then it will simply SUBST the current version of the company-name template - I only want it to be SUBST'd at the time the welcome template is placed on a user talk page. --  Phantom Steve / talk &#124; contribs \ 16:42, 23 January 2010 (UTC)


 * from the way you phrased this, it sounds a lot like an effort at social engineering, which usually doesn't fly well on wikipedia (too easy to circumvent anything if one tries hard enough). or am I misreading your intent?  maybe the bigger picture, with a clear example, would help here.  -- Ludwigs 2  23:40, 26 January 2010 (UTC)

Parameter defaults example is wrong?
I think the example is misleading. Here is what leads me to this conclusion: I created a new Template:Peoplepetsd as defined in the Parameter Defaults section. Then, I edited the section's wikicode to include the actual example:  and previewed the change. This gives "", instead of "Bill and friend own a dog named Queenie who is 7 years old". Am I overlooking something? --MrFusion42 (talk) 10:27, 7 February 2010 (UTC)
 * Yes, in you have specified   instead of  . The pipe symbol "|" is important here; it defines what to do if the fourth unnamed parameter is not present. By putting a pipe, you say that "if this parameter is missing, use a default value instead", which may be blank. But by omitting the pipe, you say that "if this parameter is missing, I want the seven characters " " to be taken literally and not put through any wikicode processing. In summary: if there is no fourth unnamed parameter:
 * is removed
 * is left alone.
 * -- Red rose64 (talk) 10:59, 7 February 2010 (UTC)

Trouble with div tag with attributes inside template
I'm having trouble using a div tag inside a template. Inserting a div with any attribute inside a template parameter results in the parameter being ignored. For an example, you may copy this snippet in the sandbox.

The result is: For location, see .

There is no problem when no attribute is present. Is this a known limitation? Is there a way around this? Moreauf (talk) 19:00, 23 February 2010 (UTC)


 * again, this is a problem with the equals sign (which the template interprets as a parameter descriptor). this works:


 * where the equals sign is replaced by the utility template = -- Ludwigs 2 19:44, 23 February 2010 (UTC)

Template include size is too large?
When you're trying to preview the "External links" section on Othmar Karas, Wikipedia replies "Warning: Template include size is too large. Some templates will not be included." And when you save, Wikipedia's software doesn't parse all the templates included (see the article). Why is this? (It's because the templates are deemed too large, I know. I'm asking why there's a limit for the size of templates included.) --bender235 (talk) 14:18, 7 March 2010 (UTC)


 * There has to be some limit, otherwise a malicious editor could make the servers use up more and more resources when creating the page. Perhaps the templates are more elaborate than is appropriate for navboxes. I would suggest moving the discussion to one of the template talk pages, such as Template Talk:Members of the European Parliament 2009–2014. — Richardguk (talk) 15:07, 7 March 2010 (UTC)


 * No, those templates are just right, see Members of the European Parliament 1999–2004, Members of the European Parliament 2004–2009, and Members of the European Parliament 2009–2014. It seems like the limit for template size is too small, therefore this discussion is at the right place. --bender235 (talk) 16:44, 7 March 2010 (UTC)


 * Well I'm pretty sure those are the templates taking the article beyond the limit, so individually they are functional, but in combination they are too much. If you look at the HTML source code when you view the article, you will see near the end (line 2185) something like:


 * So the three templates have caused the parser to exceed the 2 MB limit. As the limit is a general technical issue, you could add a request at Village pump (technical)‎‎, asking for it be raised. But personally, I think the current limit is high enough to cope with reasonable use; it is the templates that are unreasonably large, considering that navboxes are meant mainly for navigation so ought not to be very complex.
 * — Richardguk (talk) 23:05, 7 March 2010 (UTC)

Pass-Through Parameters (Faux Inheritance)
I have 10 templates. These 10 templates each have 100 variable parameters, I.e. the parameters only display if they are given a value.

90 of these parameters are exactly the same in each template. The other 10 are completely different for each template.

How would I make it so that I don't have to reimplement those 90 identical parameters in 10 different places? The obvious solution is to make those 90 parameters their own template, and then include that template in each of the original 10 templates somehow. Unfortunately, to do this you have to put in each and every one of the 10 templates
 * {{Shared Template
 * {{#if: {{{parameter1|}}} | {{!}}parameter1{{=}}{{{parameter1}}
 * {{#if: {{{parameter90|}}} | {{!}}parameter90{{=}}{{{parameter90}}}
 * }}
 * }}

This means that not only have you not eliminated the identical code, you have made things two to three times as bad! Plus you now have a template containing those 90 parameters that is essentially worthless!

So does anyone know if there is a non-colossally-stupid way of doing this? Or is there no way at all? --Cogniac (talk) 19:25, 6 April 2010 (UTC)
 * well, first: YOU'RE INSANE! That being said the non-colossally-stupid way will vary depending on precisely what it is you're doing.  can you give more details?  -- Ludwigs 2  20:28, 6 April 2010 (UTC)
 * Steady on, WP:NPA and all. However far-fetched the idea, Cogniac might just have a good reason. I'd like to see it though... -- Red rose64 (talk) 20:33, 6 April 2010 (UTC)
 * The 'insane' bit was meant humorously - sorry if that didn't come across. I'm happy to help him with it myself. {{=)}}  however, I do think we need more details about what he's doing.  when you're dealing with a template of that size and complexity there are a lot of factors to consider.  -- Ludwigs 2  15:33, 7 April 2010 (UTC)

Well, since this topic has apparently piqued some people's interest, I will explain further.

I do not actually have 10 templates, each with 100 variable parameters, 90 of which are identical. I was using nice round numbers to attempt to explain, in a general way, what my overall problem was. In reality, I actually have 1 template with precisely 174 variable parameters (with more that need to be added, no less), that I wish to turn into one template with 172 of these parameters, and another template that has all 174, 172 of which are obviously shared with the other template.

Let's get specific: I help run a wiki about Ultima Online. It's an MMORPG. In the game, there are items. These items, when moused-over, display a floating tooltip. This tooltip contains a list of the item's properties. I have written a rather complicated wiki template that is intended to mimic a display of the character's in-game backpack open with the item in it, and the mouse-cursor hovered next to it displaying the tooltip.
 * This is the template: http://www.uoguide.com/Template:Itembox
 * This is the template in action: http://www.uoguide.com/Armor_of_Fortune
 * This is the template in a test case, using almost every parameter at once: http://www.uoguide.com/UOGuide:Sandbox

The template contains (or will eventually contain) a parameter that corresponds to every single property that could ever be found on an item. Since it should be rather obvious that every single item in the game does not possess every single property, each parameter in the template is optional. When using the template, a contributor can copy+paste only the small subset of parameters they will need for a particular item, and then fill them in. Parameters 1 and 2 are related to the image of the item that is placed over the backpack image, and parameters 3-174 relate to the various item properties.

World of Warcraft is another MMORPG. It has a wiki that is overwhelmingly larger than ours, located here: http://www.wowwiki.com/ They have a somewhat similiar tooltip template, however theirs does not feature the backpack, and item images in WoW are included inside the tooltip itself, both in-game and in their tooltip template. As a result, they have been able to implement some fancy AJAX concerning tooltips. On this page: http://www.wowwiki.com/Sword hover your mouse over any of the internal links surrounded by single brackets, such as "[Thunderfury, Blessed Blade of the Windseeker]". If you give it a moment, it will go fetch the tooltip from the linked page, and then hover it next to your mouse. This is what I am trying to implement.

Unfortunately, since my Itembox template has images of a backpack, the item, and a mouse cursor in it, and it would look fairly bad to have those things floating about when you hover over things, I need to divorce the tooltip portion (parameters 3-174) into their own template so that they are the only thing that gets displayed by the fancy tooltip hover AJAX. But these parameters still need to be used by the Itembox template on actual item pages, so I want to avoid having to implement 172 parameters, word for word, in two separate templates.

Now, having taken the extensive time required to type out this explanation, I have thought of a possible solution for this very specific case: write some JavaScript code to just parse the generated HTML and rip out the tooltip portion and display only that in its floating. However, I have seen many other, less specific cases where OOP-like faux inheritance would be great. You could have 5 templates with 2 parameters each, 1 of these parameters being exactly the same for all 5 templates. If this parameter has the same, static value in all 5 templates, the solution is simple: implement a single template that merely contains this static value, and then include this template as part of your original 5 templates. But if this parameter has a variable input value, and/or is optional, you can't implement a single template that implements this parameter, include it in your 5 templates, and then just pass the values through. You have to reimplement, word for word, this repeated parameter in 5 separate places.

Surely there must be some way around this? --Cogniac (talk) 22:18, 7 April 2010 (UTC)

One thing I'm trying to do in implementing a wiki
I am trying to implement a wiki for the National Center for Atmospheric Research in Boulder, Colorado, here templates for said wiki. A couple questions:

I want to generate a parameter that for 99 percent a cases, I get a certain "default text." In rare exceptions, I want an "exception text." Something like the following:

importantText = #switch:


 * exception = Exception Text


 * #default = Default Text |

Then below I use said parameter. But there's some little irritating thing I'm doing wrong. Have poked about Wikipedia pages, but not figured out.

Ideas? Here or my "talk" page.

Thanks!

Faesrwiki (talk) 19:10, 12 April 2010 (UTC)


 * If there are only two possibilities, you can use


 * If there are more than two, you can use a switch statement


 * Or am I missing something? Plastikspork ―Œ (talk) 15:14, 16 April 2010 (UTC)

-

Works, at least the first, all I really need, Unsure of second. Thanks.

Faesrwiki (talk) 15:58, 16 April 2010 (UTC)

Turing-complete
I have always wondered: Are Wikipedia templates, with their parser functions, Turing-complete? They seem so, but confusngly so.VNNS (talk) 15:22, 20 April 2010 (UTC)
 * Symbol_move_vote.svg Have you tried the Computing section of Wikipedia's Reference Desk? They specialize in answering knowledge questions there; this page is for discussing improvements to the page Help:Template. For your convenience, here is the link to post a question there: [ click here] . I hope this helps. -- Red rose64 (talk) 16:13, 20 April 2010 (UTC)


 * I think the technical answer would have to be 'no', for three reasons.
 * the wikimedia software automatically stops infinite recursion, for pragmatic reasons, therefore there are conceivable results that cannot be achieved.
 * processing is mono-directional, from the most deeply nested template out. there is no true looping, and branching is limited.
 * the software (currently) has profound limitations on its manipulations of symbols. With the exception of things like capitalization (for which there are specific parser functions) text passed as parameters cannot be modified arbitrarily.
 * A turing machine could, for instance, start with a line of text like "The red fox jumps over the sleeping dog" and modify it so that it produced any other (arbitrary) phrase. That is impossible with wikimedia templates.  A mathematical proof is beyond me, though; if that's what you want, the computing desk would be the place to go.  -- Ludwigs 2  16:56, 20 April 2010 (UTC)

Restrictions on the use of templates
Apparently templates are treated like everything else in Wikipedia when it comes to defining or not to define. I hope this is not true but is there a Policy on using templates. Now "how to." But "Why" and "How should". Use of side templates comes to mind vs using them at the bottom. I have another case entirely in mind where a good faith editor has defined a template which will undoubtedly proliferate and take over articles! Gadzooks! Student7 (talk) 16:07, 21 April 2010 (UTC)
 * I assume that you are referring to . This is what is known as a navigational template, navigational box or simply navbox; policy and usage should be covered at WP:CLN and WP:NAVBOX. It's currently under discussion. -- Red rose64 (talk) 16:21, 21 April 2010 (UTC)


 * Exactly. Thanks. (I have often thought mind-reading would be useful. How is it done? :) Student7 (talk) 20:09, 22 April 2010 (UTC)
 * I went to your contributions and looked at your recent talk-page edits. -- Red rose64 (talk) 20:36, 22 April 2010 (UTC)

Transcluding a tag
I have a subtemplate that I want to include  tags. I have this: {| ! Type !! Name !! Description

I want it, when transcluded into the main template, to remain with the the  tags in place. So that main template would result in this:

Is there any way to achieve such behaviour? —Preceding unsigned comment added by 87.112.178.122 (talk) 18:49, 23 April 2010 (UTC)

Challenge
I'm trying to set up an WExample template to simplify help pages on MediaWiki syntax and templates documentation. Normally to something like

you have to type the code twice, once between   tags, and once without. WExample should do this automatically. Now it works as long as its parameter doesn't require a transclusion, so for example it cannot be used on itself :

The source isn't correct on the leftmost side. Who will be able to solve this will get my eternal gratefulness, and his name engraved in the history of this very useful template ;-)

--Goulu 11:45, 30 April 2010 (UTC)


 * Frankly, I think you'll be much happier if you make two separate templates: one for plain-text examples, and a second template that deals with transclusions. The problem is that templates process from the bottom up - if you put template A in as a parameter to template B, template A will be processed first and the result will be fed into template B, so any pre or nowiki tags will act on the processed result of template A, not on the original tag.  it's a bit anti-intuitive (I think of it as a fall-through paradigm: every parameter value falls through to the lowest level it can reach, first, and then the text is built up from the bottom).  let me think about it a bit more, though.  -- Ludwigs 2  07:49, 12 June 2010 (UTC)


 * See also m:Help:Expansion demo templates. Indeed, separate templates are used for each pattern of inclusions. In this case you can use Template:demo-inline:


 * Patrick (talk) 09:56, 12 June 2010 (UTC), edited in November 2022 by user:Jonesey95

I need help making a template
How do you make a template like the see also one where you can add pipes within the template brackets and then add article titles. I need to make a template like this. Where I can write something like { {exampletemplate|title of an article} } Daniel Christensen (talk) 02:50, 12 June 2010 (UTC)


 * err... look at the code for see also.  basically, though, the operative unit is this | .  Breaking that down, it's just a normal link of the displayedtext variety, with some embellishments.  For instance:
 * it adds a colon articlename so that categories, files, and other types of wikipedia pages are links rather than transculsions
 * it gives display test to the link using a tricky default mechanism - - which basically says "if there is a parameter 1 then name the link after parameter 1"  you could simplify that for most other purposes
 * -- Ludwigs 2 08:04, 12 June 2010 (UTC)

Deleting a Template
I need to delete a template I made but I can't find a way to do so. Does any one know how to navigate this highly confusing site? —Preceding unsigned comment added by ThomasHorn7 (talk • contribs) 00:59, 25 June 2010 (UTC)


 * just nominate it for speedy deletion by adding db-author at the top of the page. see Criteria_for_speedy_deletion.-- Ludwigs 2  01:26, 25 June 2010 (UTC)


 * My response amounts to the same thing as Ludwigs2's, but it's a little more detailed, so I'll add it anyway:
 * Any page, including a template, can be deleted at the author's own request, under speedy deletion criterion G7 ("Author requests deletion: if requested in good faith and provided that the only substantial content to the page and to the associated talk page was added by its author...."):
 * Make sure that there aren't any articles that still use the template (you can check for links at Special:WhatLinksHere/Template:Your template name or from "What links here" in the Toolbox on the template page's left-hand column).
 * Replace the template text with
 * See the introduction to Criteria for speedy deletion for background guidance.
 * If the template is not eligible for speedy deletion (for example, if someone else has made significant edit to the template), there is a slower process, described at Templates for discussion.
 * — Richardguk (talk) 01:37, 25 June 2010 (UTC)

Help making a template
Hi. This is my first time making a template that actually uses parsers and could use some help. I've started it here and was wondering if someone could take a look. I'm trying to get it so that if the date entered into the template is in the past, then it won't use the nested template. BOVINEBOY 2008 16:02, 23 July 2010 (UTC)
 * For testing to see if a date is in the past, I would suggest calling another template for simplicity, like say Age in days, or Time ago. This would most likely simplify the code a bit. Plastikspork ―Œ (talk)  18:12, 23 July 2010 (UTC)

Questions about old parameter names and templates
I think I know the answers to these questions but I could be wrong. Should there be a concern that old versions of pages are broken when:


 * 1) A template is deleted that was widely used in the past.
 * 2) Parameter names change and the old parameter names become invalid.

I there a consensus or a policy. Thanks. – droll  &#91;chat&#93;  16:59, 2 August 2010 (UTC)


 * A template deleted through TfD is always updated, either by SUBST or replacing it with another template
 * If template parameters are replaced, then it is the responsibility of the editor to ensure that all uses are updated
 * ---— Gadget850 (Ed)  talk 17:08, 2 August 2010 (UTC)


 * So fixing current articles is good enough? I should not worry about previous (archived) versions? – droll   &#91;chat&#93;  17:53, 2 August 2010 (UTC)


 * Do you mean trying to fix versions in the article history? You can't do that— if you edit an old version, it becomes the current version. ---— Gadget850 (Ed)  talk 18:05, 2 August 2010 (UTC)

Let me restate my question focusing on the case where a parameter name is changed.

There are versions of articles which are "archived" and can be retrieved using the history functionality. Consider the case where an "archived" version is retrieved. If that version attempts to transclude a template in which a parameter name has changed then there is a conflict. Is there any concern in this regard. I don't care if there should be concern. I just what to know what is considered "best practice". – droll  &#91;chat&#93;  18:38, 2 August 2010 (UTC)
 * Making historical versions of articles still render correctly is nice, but I would say is not critical. It is certainly less critical when the part that is broken is a navigation panel, or something which is not necessary for understanding the text.  I would say there is also a reasonable length of time that one could expect old versions to be viewable.  I know that some admins delete such convenience redirects as "implausible", while others seem to encourage keeping them around.  There was a recent case of an old Mathematics sidebar template which was kept at TFD due to the editors wanting to be able to see it in old versions (see Divisor classes discussion).  I would think there should be some amount of time after which this would no longer be a valid argument (say a year or two maximum). Plastikspork ―Œ <sup style="margin-left:-3ex">(talk)  18:46, 2 August 2010 (UTC)


 * It is conceptually possible to do this, but it would be a considerable amount of work and entail a very large server load. Functionality could be created that would go find the appropriate old versions of all the templates used in an old page version (and the templates that the templates use...). Something like this may be developed someday, although it may be something used by a researcher. There are loads of issues with deleted revs; lots are deleted or oversighted for very good reasons. This sort of thing is done by forensic Wikipedians on a manual and as-needed basis, but it's tedious. One thing that bugs me, occasionally, is that too many old redirects are deleted. Sure, nothing may use them now, but they may be referenced in old revs or in old edit summaries. We don't have Special:WhatUsedToLinkHere (for most of the same issues, really;)
 * re old parameter names; templates can support deprecated names, and sometime should even after all usages are updated.Cheers, Jack Merridew 19:17, 2 August 2010 (UTC)


 * Thanks all. I was asking in regards to Infobox mountain. It has a wrapper which retains compatibility with historical article versions. I really didn't know if the wrapper should be removed or not. Retaining it imposes some server load. I understand about revision control. In a perfect world perhaps such a system might be possible. – droll   &#91;chat&#93;  22:13, 2 August 2010 (UTC)

Template bug
When I do (or just the tag at all) after here, I get a   frame for no reason. Why is this happening? Can I solve this? All I know is it only happens with that particular template, not the other templates I use on my user page. / Hey Mid  (contributions) 19:30, 3 August 2010 (UTC)


 * There was an extra newline at the end of the template. I fixed it. Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  19:35, 3 August 2010 (UTC)
 * Ahh, so it wasn't my fault. Thanks for fixing! / Hey Mid  (contributions) 19:36, 3 August 2010 (UTC)

Space between dot
Is it possible to fix this? It looks weird when there is a space between the dot and "Microsoft Windows" in the first top template. In that version, no variable has been added. / Hey Mid  (contributions) 10:47, 4 August 2010 (UTC)

It looks like this: / Hey  Mid  (contributions) 10:48, 4 August 2010 (UTC)


 * Fixed using a numeric character reference to force the space character to show only inside the #if block. I note that there's no Windows 7 graphic at present, but I didn't fix that in case it is intentional. — Richardguk (talk) 12:13, 4 August 2010 (UTC)
 * That did it. Thanks! / Hey Mid  (contributions) 12:38, 4 August 2010 (UTC)

noinclude to enclose cats
Let's say I'm constructing a navbox template, using, and I want the finished template to appear in a certain category, which shouldn't contain the transcluding articles. There are two ways of doing this, (a): &lt;noinclude&gt; Category:Example  &lt;/noinclude&gt; or (b): &lt;noinclude&gt; Category:Example &lt;/noinclude&gt; The crucial difference which I want a judgement over is whether the &lt;noinclude&gt; should be on a new line or directly follow the, so which of these is correct? Please point me at a help/policy doc that says that is the correct form, so that I can refer to it in an edit summary. -- Red rose64 (talk) 11:35, 13 August 2010 (UTC)
 * I usually put the noinclude on the same line as the }}. I have had problems with spurious newlines, and although it works sometimes to have it on the next line, it seems like a good idea to just move it up. For example, see the "template bug" section just two sections up. Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  17:52, 13 August 2010 (UTC)
 * I'm perfectly happy for myself that format (b) is correct; but I am afraid that if I make such an edit to certain navbox templates, I may well be reverted without proper explanation. I'd like to be able to link to a policy from my edit summary to forestall this. Talk page discussions don't carry as much weight as pages in Help/Wikipedia namespaces. -- Red rose64 (talk) 18:44, 13 August 2010 (UTC)


 * The main difference is that version A will produce an extra line after the template. often this is of no consequence, but sometimes this can produce odd formatting effects that are difficult to track down and eliminate (since most people won't think to look at the template, or recognize that this construction can generate whitespace in the article).  -- Ludwigs 2  02:06, 24 August 2010 (UTC)
 * I know all this: but I need to convince others not to insert the linebreak. Thus, I want to point them at a suitable guideline or policy. -- Red rose64 (talk) 15:44, 24 August 2010 (UTC)
 * I think it's basically common sense, but I suppose it could be placed in one of the MOS guides. Otherwise, just be bold and ping some folks if you need backup :) Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  17:27, 27 August 2010 (UTC)

questions from Commons
Hi, I'm mainly active on Commons (under the name Zolo), and I've been told there that questions about templates had better chances to get an answer if they were asked here, so here I am. I've tried to upgrade template:technique/en. It is the English part of a template that automatically translates the name of the materials used in an artworks into the user's default language. For instance, gives "oil on canvas". What I've tried to do is to add parameters so that we can write we get oil and tempera on canvas. I needed the same list of materials two times (or even more), and I wanted to avoid to copy it. So I nested the template in itelf, hoping that it would start again at the beginning. ({{#if:{$🇦🇩$} | &#32;and {{technique|{{{and}}}} }}). But I get a "loop detected" message. Can anyone suggest me an alternative solution ? (note: I thought my template used to work, but maybe I just mixed the test template with the real one, so that the loop was avoided) --Superzoulou (talk) 20:29, 23 August 2010 (UTC)


 * A template cannot transclude itself. You could put the original template into a new template named something like commons:Template:Technique core/en and then transclude it from a revised version of commons:Template:Technique/en with the latter template containing the, etc parameters. — Richardguk (talk) 23:10, 23 August 2010 (UTC)


 * looking at the template, it would probably be easiest just to call it twice from the main image template, and not muss with adjusting the 'technique' template. you could modify it as above, of course, but I suspect it would be more of a headache than the result would justify.  -- Ludwigs 2  02:14, 24 August 2010 (UTC)


 * Ok, thank you very much. Since the template is very widely used and the "and" parameters could easily be used in hundreds of files, I think I'll try with a core. If it doesn't work, I'll just call the template twice, but for automatic categorization or things like that, it may be better to have a single template call.--Superzoulou (talk) 11:48, 24 August 2010 (UTC)
 * I have added a commons:Template:Technique/en/list with all the supported terms. It works well. However, if I can ask some more questions, I have another (unrelated) problem with the French version of the template. At some points, new lines are created and I don't see why (see commons:user:Zolo/test)--Superzoulou (talk) 15:54, 3 September 2010 (UTC)
 * ✅ I have amended one of the subtemplates. Basically, the  needs to follow the "real" template code directly, without intervening spaces or newlines (see thread above). -- Red rose64 (talk) 20:21, 3 September 2010 (UTC)


 * Oh, I've just attempted to fix this problem at the same time but by amending commons:Template:Technique/fr (as with Redrose64's edit to commons:Template:Technique/fr/list, I commented out problematic spaces but also hard coded in some required spaces). I guess Redrose64 found the real problem and my edit made no difference. Anyway, hopefully all is well now. — Richardguk (talk) 20:45, 3 September 2010 (UTC)
 * Okay, thank you very much for the explanations and the modifs. I had also had to spot errors I made for other things in the template, but it seems to work well now.--Superzoulou (talk) 15:52, 4 September 2010 (UTC)

The #replace function
It looks like the MediaWiki parser function #replace function does not work on Wikipedia. Is it not installed? Are there any alternatives? I really need this function to create some templates

Any help is greatly appreciated --کاشف عقیل (talk) 18:45, 31 August 2010 (UTC)
 * See Str rep, although I would recommend not using it in general. Perhaps if you outline the problem that you are trying to solve, and we may be able to suggest an alternative. Thanks! Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  20:05, 31 August 2010 (UTC)
 * Thank you very much Plastikspork. It worked. I also tried Str repc and that seems to be a better alternative. I am trying to solve a very simple problem. On Urdu Wikipedia, I need to create templates for calendar related pages. As we are supporting articles on two different calendars there, Gregorian and Hijri, the article names have a suffix to indicate which calendar this belongs to. For example, the article for Gregorian 1901 is 1901ء. I just needed to remove the suffix so that the template can use the year in calculations. Thanks again for your quick help. --کاشف عقیل (talk) 00:35, 1 September 2010 (UTC)
 * If you just need to extract the first 4 numbers, then str left is fairly robust, and based on the padleft parser function. If you don't know how many characters you will need to extract, and just want the numeric content, then it can be come a bit more complicated.  However, if  is working, and not causing the page/template to render to slowly, then no need to try to fix something that isn't broken.  I'm glad that worked. Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  04:01, 1 September 2010 (UTC)
 * That's impossible the way you suggest, at least without the string functions extension (which wikipedia doesn't implement). The only workarounds I can think of off hand are (1) to create distinct templates for the two calendars, or (2) to change your naming convention so that the suffix is a prefix - that way you can use simple structure to test which calendar you should use. -- Ludwigs 2  04:07, 1 September 2010 (UTC)
 * We have str left, str right, str repc, ... These are expensive, but they do work on occasion. Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk) 04:42, 1 September 2010 (UTC)
 * I was took quick in reporting that Str repc works :). It does work but is quite unstable and gives errors most of the time in my case. I am going to try the combination of Str find and Str left next and see if that is more stable. --کاشف عقیل (talk) 16:00, 4 September 2010 (UTC)

Adding the "#" symbol to a double-bracketed link inside an if-tag
Hi! I want to add the "#" symbol to a double-bracketed link inside an if-tag. If a variable in is specified, I want the link to point to a section in the article, specified by. My template is User:Heymid/IP-koll. When I write " ", the result is [ this] (creates a list instead). What is the problem? How can I fix this problem? / Hey Mid  (contributions) 14:52, 3 September 2010 (UTC)
 * One easy solution is to replace the # with a &amp;#35;, which will prevent WP from parsing it as a list entry. I have made the changes in your template as a demonstration. Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  15:47, 3 September 2010 (UTC)
 * Thanks! But sorry, I forgot that I could do it that way... / Hey Mid  (contributions) 15:53, 3 September 2010 (UTC)
 * Also, it is probably a bug in the MediaWiki software. / Hey Mid  (contributions) 15:57, 3 September 2010 (UTC)
 * I wouldn't call it a bug, but instead a feature. This is a common issue when generating hex codes for HTML colors. See, for example, Australian politics/party colours. Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  16:21, 3 September 2010 (UTC)
 * What I mean the bug is, is the fact that Wikipedia parses it as a list entry, when it in fact shouldn't. This bug applies to all if- and switch templates, etc. / Hey Mid  (contributions) 16:51, 3 September 2010 (UTC)

Generating reference with substitution
So the page says "Parameters do not get expanded when they are inside nowiki tags or XML-style extension tags." Is there any feasible way to work around this? My problem is that I have a template that may need to generate a reference based on its named parameters. So, I am using #if to test the parameter for a value, and if true, I want to generate. With the above limitation though, the does not get expanded. I have tried putting the inside its own templates but I guess the must be in the same page as the start tag because I get an error about no content specified for an unnamed reference. There was a related question in /Archive_1 but no verified solution was given (I tried the suggestion but it didn't work). I'm stuck as to how to get around this expansion limitation. RedWolf (talk) 17:14, 5 September 2010 (UTC)


 * The approach I'd try first would be using the parser function.  That way you can generate the html tags on the fly, and since templates are expanded from the inside out, the tags should be generated after the inner text is processed by the parser. see this page. -- Ludwigs 2  17:26, 5 September 2010 (UTC)


 * Yes, exactly. The trick is to use .  Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  19:04, 5 September 2010 (UTC)


 * The error message should have had a link to a help page, unless you have your language preference set to other than 'en' (I need to redirect the British messages). See WP:REFNEST for more help. ---— Gadget850 (Ed)  talk 20:25, 5 September 2010 (UTC)
 * Which is a red link? Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk) 22:46, 5 September 2010 (UTC)
 * Red link? I don't see no redlink. ---— Gadget850 (Ed)  talk 23:22, 5 September 2010 (UTC)


 * Thanks for the suggestion. First of all where is #tag documented? I see it referred to on Help:Extension:ParserFunctions but no actual description of what it does exactly although I can infer based on the above. Secondly, when I tried that subst:#ref, my test call (when called from a main template) resulted in a line in the references section with just the ^ and without any actual text after it. If you simply call it directly, there is no parameter substitution. See User:RedWolf/Template:Canada census/reference and try calling it with year=2001 and access_date=2010-09-05:
 * The intent is that this template will be conditionally called from a main template. RedWolf (talk) 02:36, 6 September 2010 (UTC)
 * The intent is that this template will be conditionally called from a main template. RedWolf (talk) 02:36, 6 September 2010 (UTC)


 * I made a small change, so it can be substituted. Is that what you want?  Basically a combination of WP:REFNEST and WP:Safesubst. Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  04:18, 6 September 2010 (UTC)


 * Yes, that's what I wanted (I tweaked it slightly to add the year in the ref name since each year needs a different citation). I find Java development much easier than this quirky template syntax! :) Much thanks for your assistance. RedWolf (talk) 08:00, 6 September 2010 (UTC)

Help with template
Hi. I simply just can't remove the extra  }}  displaying in Template:Infobox power station (temp). Can someone help, please? Rehman(+) 03:11, 9 September 2010 (UTC)


 * I think I've it. Note that the /doc page needed to be purged after saving the fix for it to display correctly. — Richardguk (talk) 09:07, 9 September 2010 (UTC)


 * Thank you very much Richard! Rehman(+) 09:17, 9 September 2010 (UTC)

Help again
I need to make the website and as_of fields in Infobox power station (temp) look like the fields in Infobox nuclear power station; centred across the two columns. But I don't seem to be able to fix it. Can anyone help please? Rehman(+) 14:26, 16 September 2010 (UTC)


 * . You forgot to include a pipe character  to separate the   sections. Also, the table pipe characters   inside the   block need to be escaped using  otherwise they get mistaken for pipes meant to separate the   sections. — Richardguk (talk) 00:11, 18 September 2010 (UTC)


 * Thanks! Just a few concerns though. If the as_of is filled and the website is not, then both doesnt display. But, if both are filled, then it looks like this. Is it possible to make each field independent like the other fields?
 * Also, a  Website  and  As of   shows up in the top-right box at Template:Infobox power station (temp). Bug?
 * Can we make the two fields look somehwat exactly like the fields at Template:Infobox nuclear power station? Centred with a shorter horizontal line spanning between the two fields? Rehman(+) 02:40, 18 September 2010 (UTC)


 * Mostly . There was a typo mixing and . All fixed except the formatting of the dividing line as that would make it inconsistent with the styling for the "infobox bordered vcard" classes that you have applied (or at least, it was confusing me!). — Richardguk (talk) 01:17, 19 September 2010 (UTC)


 * Thanks a ton Richard! Its perfect! Rehman(+) 01:23, 19 September 2010 (UTC)

need inline template for custom string and Talk section link
Is there an article namespace inline template that displays a custom text and links to the article's talk page's specified section or topic? If not, can it be designed?

In a recent case, I wanted to say that a purported fact in the text was doubtful and refer editors to a Talk topic about the issue. First, tpl produced an unbracketed full-size string, and, while it was clickable, it was confusing because the text was full-size and appeared to be an ungrammatical part of the main text itself. What I came up with instead was undefined. That produced [Doubtful. See talk topic: third wave started later and not ended.]. Clicking it takes the user to the talk page but not to the topic. I suspected that embedding a full link in the style of [Doubtful. See talk topic]. would break somewhere.

What to do? Thanks. Nick Levinson (talk) 07:48, 12 September 2010 (UTC)
 * Is suitable for your purpose? -- Red rose64 (talk) 14:57, 12 September 2010 (UTC)


 * Not quite. I've seen it in use and didn't know it linked to talk topics. I thought that. like other inline tags, it linked to a general definition of the template, so I wouldn't click on it. Thus, I'd like an option for a custom string.


 * Also, would need an edit to its documentation, because it's meant only for escalation from the fact (or citation-needed) template.


 * Is there another possibility? Thanks. Nick Levinson (talk) 20:51, 12 September 2010 (UTC) Corrected a link: 21:02, 12 September 2010 (UTC)
 * Well, the way that I understand it, provided that you start by raising a thread on the article's talk page, there doesn't need to have been any previous tagging. Let's say that you raise such a thread, expressing your concerns, and it's titled "Dodgy statement". Then you would go to the article talk page and add the tag in this form:
 * Alternatively, how about ? That has a more versatile form of talk page linking, since although the clickable message always goes to Please clarify, it can be given additional text either before or after, which may contain a talk page link:
 * -- Red rose64 (talk) 21:46, 12 September 2010 (UTC)
 * -- Red rose64 (talk) 21:46, 12 September 2010 (UTC)
 * -- Red rose64 (talk) 21:46, 12 September 2010 (UTC)


 * Looks like clarify would work. I'm not keen on a template that works only if someone looks in the source code, since they probably won't look there if the template in the article doesn't give a clue about what'll be in the source code, so dubious wouldn't do, but I'll try to remember for next time. Thanks. Nick Levinson (talk) 08:05, 13 September 2010 (UTC)
 * Puzzled - I thought that I mentioned that if is given an unnamed parameter, that becomes the link to the talk page section? For example, try clicking the "discuss" link here: -- Red rose64 (talk) 15:03, 13 September 2010 (UTC)


 * Then I think I misunderstood. I'll consider using dubious in the future. Thank you. Nick Levinson (talk) 04:27, 15 September 2010 (UTC)

Wikipedia talk:WikiProject Schools
✅ Would any editors experienced with templates help with his/her request at Wikipedia talk:WikiProject Schools? Thank you, Cunard (talk) 23:53, 19 September 2010 (UTC)


 * I believe I took care of this problem back on september 8 - . if there's more to be done, let me know on the infobox school district talk page.  -- Ludwigs 2  20:09, 3 October 2010 (UTC)
 * Yes. It was taken care of because of a request on WP:VPT, I was sure I removed this request, or noted on it. Sorry for the inconvience. -- Wolfnix •  Talk  • 13:34, 4 October 2010 (UTC)

Browser differences for Template:Clade - help?
Hi, all. I noticed some browser differences for clade and was wondering if any more experienced template editors could help. See Template talk:Clade. Cheers, Rkitko (talk) 00:08, 20 September 2010 (UTC)

Help:Tennis template
I just noticed that the template Template:WikiProject_Tennis is forcing the "Talk" pages into the actual article "Unassessed" category: Category:Unassessed_tennis_articles. I figure it is an include issue, but cannot seem to see it. Should be including the article, but not the Talk page? Can any template masters take a crack at it? Thanks in advance. -- Mjquinn_id (talk) 19:28, 3 October 2010 (UTC)
 * I believe that is the way it works. If you click on the parent category, you will see all the unassessed article categories.  I don't know of any of them that list the article rather than the talk page.  This is due to the fact that the talk page is tagged with the WikiProject banner, and not the article.  Thanks! Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  19:35, 3 October 2010 (UTC)
 * Yes, it looks fine to me. If it still seems to be a problem to you, a question at Template talk:WPBannerMeta will attract the attention of the experts in WikiProject banners, because (like almost all other project banners) is built around . -- Red rose64 (talk) 19:49, 3 October 2010 (UTC)
 * The template could be changed to include the actual article rather than the talk page without too much trouble, but since the point of the category is to get editors to review and class the article and enter that class on the talk page, it really makes no difference. -- Ludwigs 2  20:02, 3 October 2010 (UTC)
 * And then we would be tagging the article, rather than the talk page. There is no way, that I am aware of, for a template on a talk page to put an article in a category, rather than the talk page. Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  20:08, 3 October 2010 (UTC)

ill
I can't figure out how to fix this template so that a space appears between the English redlink and the interwiki link (in other words, to correct it to use better spacing format in the style of belg). Can anyone fix this for me? Wareh (talk) 20:48, 3 November 2010 (UTC)


 * Done.--Patrick (talk) 23:29, 3 November 2010 (UTC)


 * Many thanks, Patrick! Wareh (talk) 13:07, 4 November 2010 (UTC)

string handling
Hello, I am trying to create a template that would transform painter, sculptor, musician into

I manage to get the first word using trunc but I can't find any similar template for words to the right of the coma (str right produces errors. Can anyone help ?

(note:I want to use the template on Commons but tried it here because we have no string manipulation templates out there).

--Superzoulou (talk) 17:23, 18 January 2011 (UTC)
 * These string processing templates are very fragile, and I am not surprised they are giving you problems. They are basically almost all based on expensive hacks which overload the "padleft" parserfunction.  You would be better off passing them all into one field, and having a bot split them into subfields.  With that said, this should be possible in some cases, I just don't think you will be able to do it reliably.  For example, if the input string is too long. Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  23:42, 19 January 2011 (UTC)
 * Ok thanks, I hope we get something better some day--Superzoulou (talk) 20:32, 20 January 2011 (UTC)

Adding field to Template:Official website
I would like to add a feature to Template:Official website It should be able to display: ... by allowing someone to put in an extra field for a mobile site Such as "|mobile=http://m.cnn.com WhisperToMe (talk) 21:31, 19 January 2011 (UTC)
 * Official website (Mobile)
 * Try this version in the sandbox. Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk) 23:46, 19 January 2011 (UTC)
 * Thank you! It works at CNN WhisperToMe (talk) 01:49, 20 January 2011 (UTC)

Help with selected transclusion
Hi. I have recently created TAYG episode which at this stage is a mask for Episode list. I have unsuccessfully tried to add code to only transclude some of the parameters (i.e. some of the columns in the resultant table). I was trying to utilise the code in Episode list/sublist but I have failed any attempt. I'd like to only transclude Episode, Airdate, B, X, Y and Notes column (i.e. leaving out EndGame, Winner, Viewers, Ratings). I have a sandbox which has some of the original data in it here with the page I'd like to transclude some of the cells onto here. Thanks to anyone who can help. Themeparkgc  Talk  02:35, 26 January 2011 (UTC)
 * So you want it to have a total of six columns (Episode, Airdate, B, X, Y and Notes) in that order? Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk) 03:07, 26 January 2011 (UTC)
 * Only when it is transcluded, yes. Themeparkgc   Talk  03:22, 26 January 2011 (UTC)
 * I see. There are basically two ways that I know of to accomplish this.  The first way would be have the template take an extra parameter, like say sublist, which when set, would hide the extra columns.  Then on the main page, with the full list, you would use either <noinclude ></noinclude> or <includeonly ></includeonly> to set the value for either the main page, or the transcluding page, depending on the logic.  The second way would be to exploit the  value for the main page and the subpage.  This would allow the template to determine if it is being used on the main page or on the trancluding page.  Is there a particular pattern for the names of the main pages or the subpages?  How many pages are going to be using this template?  Could the list of main pages be provided in a list that could be passed to a "switch" statement?  The second method hides more of the logic from the average editor, and is a bit more elegant, but it doesn't scale as well in terms of usage with lots of pages, and requires some knowledge of the page naming structure. Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  05:25, 26 January 2011 (UTC)
 * The idea is to only have to update the season page with the summary page updating automatically to show only Episode, Airdate, B, X, Y and Notes, stripping out the other columns in the process. I have tried to incorporate MainList or 1 to test to see whether it matches which is the summary page. Although the same method works perfectly for Episode list/sublist it doesn't seem to work here. This template would probably be used around 20-30 times on a single page (once per episode for the season). The whole table is wrapped in <onlyinclude ></onlyinclude> so the lead, infobox and references sections are not transcluded. The page would then be transcluded with  onto the summary page. I think the way used in Episode list/sublist is the simplest, I just can't seem to get it to work.  Themeparkgc   Talk  07:45, 26 January 2011 (UTC)

Very strange. I can get it to work in my userspace but not in the article space. I have the original full data here, with the transcluded version here. Working perfectly. When I tried to incorporate the full data on the article namespace here that worked fine, but when I transcluded it here, it did not get rid of the unwanted columns. Is it possibly the two apostrophes (" ' ") in the articles' titles conflicting with the script somehow? Themeparkgc  Talk  03:48, 29 January 2011 (UTC)
 * Yes, that's the problem. Since this is only going to be used on one page, you might as well hardcode the fix.  I will do it in a second.  The other option would be to put what I am going to paste in there in the episode articles, which would be messy, but would also work. Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  04:01, 29 January 2011 (UTC)
 * Thank you very much for getting it to work. Themeparkgc   Talk  04:39, 29 January 2011 (UTC)

Why is the template in the bottom of the page?
I have just recently worked on a template for a article expansion, located here User:AJona1992/Sandbox11. What can I do so the template can be at the section it should be in? AJona1992 (talk) 21:16, 26 January 2011 (UTC)
 * It wasn't a template issue at all, you hadn't closed the table in the section U.S. television ratings. Unclosed tables are always moved to the last section, and they then suck in the entire content of that section. I have . -- Red rose64 (talk) 21:23, 26 January 2011 (UTC)

Pass-Through Parameters (Redux)
I asked this question once before, had some responses asking me to clarify, and then after clarifying: No one responded ever again. So I'm going to try again with a simpler, thoroughly-described example.

Say I have 5 templates. Each template consists of 5 elements. These elements are all different for each template except for 1; I.e. the 5 templates share only 1 common element.

If the common element is a static object of some kind (an image, a decorative box, a standard piece of text, etc.) the obvious solution is to make a template out of that 1 common element, and then transclude it in each of the 5 templates. In each of the 5 templates, you would do this:
 * ^^ In English: All I'm doing is trancluding the template. Simple.
 * ^^ In English: All I'm doing is trancluding the template. Simple.

Voila! redundant work eliminated; you don't have to implement that element in 5 different places, only in 1 place.

Now, if that 1 common element is instead a named parameter whose value is displayed in the same way in all 5 templates, you would make a template out of that 1 named parameter and its associated display code, and then transclude it in each of the 5 templates. In each of the 5 templates, you would do this:
 * ^^ In English: I'm transcluding the template, and passing its  the value in the current template's.
 * ^^ In English: I'm transcluding the template, and passing its  the value in the current template's.

Unfortunately, you have to give each of your 5 templates a and then pass its value through to  's , which is a little redundant and features a small amount of repeated code; but at least all of the display code for that element is housed in the  template, so that part need not be repeated. So you saved some redundant work.

Now, if that 1 common element is a conditional named parameter, and looks something like this:
 * ^^ In English: If is actually filled in with a value, display it, otherwise don't display it.
 * ^^ In English: If is actually filled in with a value, display it, otherwise don't display it.

you would make a template out of that 1 conditional named parameter and its associated display code, and then transclude it in each of the 5 templates. In each of the 5 templates, you would do this:
 * ^^ In English: If is actually filled in with a value, pass it to  's , otherwise don't do anything with it. The  template then does the same thing; if its  is actually filled in with a value, display it, otherwise don't display it.
 * ^^ In English: If is actually filled in with a value, pass it to  's , otherwise don't do anything with it. The  template then does the same thing; if its  is actually filled in with a value, display it, otherwise don't display it.

Ouch. So not only do you have to implement the conditional in the template, you have to re-implement that conditional in all of the 5 templates that use it. That's a lot of redundant code. Not only do you have to give each of your 5 templates a and then pass its value through to  's , you also have to completely re-implement the conditional statement in every location. What the hell!

Basically, it comes down to this: If you have a conditional parameter that is repeated in multiple templates, you either have to just implement it in each of those multiple templates and deal with the redundant code, or you have to implement it in its own template, transclude that template in your multiple templates, and then re-implement the conditional in each of those templates anyway, thus defeating the purpose of putting it in its own template to reduce redundant code. This may sound like somewhat of a non-issue as presented, and with such a comparatively small example, but what if the template could also stand alone? I.e. is useful when displayed directly in an article and is also used as a small part of the display of other, larger display templates. Or imagine my example with 100 templates with 100 conditional parameters each, 50 of which are common to all 100 templates; it starts to get out of hand real quick.

So: Is there some way to do this that doesn't run into the problems I've outlined? Is there some basic, simple principle to templates that negates the issues I described? Or is there just no way around this whatsoever? --Cogniac (talk) 21:03, 3 February 2011 (UTC) Themeparkgc  Talk  23:32, 3 February 2011 (UTC) --Cogniac (talk) 21:13, 4 February 2011 (UTC)
 * Is this going to be for Wikipedia - or is it for UOGuide? I think that could have been why the users did not respond the last time. I would help but I think it is beyond me. I'm a bit confused with what you're wanting to do.
 * When I originally asked the question back in April 2010 my only goal was to figure out how to do this for a specific template structure on UOGuide. Since then I've realized that the problem is relevant to all wikis, including and especially Wikipedia due to the overwhelming number of templates in use here, some subset of which would be improved if this were possible. In all actuality, I should probably be asking this question at http://www.mediawiki.org/wiki/Help_talk:Templates, but a lot fewer people view that page, and it seems as though there are volunteers here at Wikipedia that either a.) possess an extensive knowledge on wiki-coding and coding for wikis that rivals anyone at MediaWiki.org just due to how much work they put in and how much code they review here at Wikipedia or b.) are literally the exact same volunteers that would be answering my question at MediaWiki.org.

I think the basic answer is no, you can't pass through parameters implicitly in the way we would sometimes want to (i.e. there's no equivalent of global variables in template logic). Though your code can be simplified - writing is no different from writing just (the meaning of the first is "the value of parameter1 if the parameter exists and is non-empty, else the empty string", and the meaning of the second is "the value of parameter1 if the parameter exists, else the empty string", which is exactly equivalent. As far as I can tell, anyway.) --Kotniski (talk) 13:31, 4 February 2011 (UTC)
 * Re: The code simplification - That works, but only with situations like my example; I.e. a parameter that has no accompanying display code. In the following example, you'd be adding a row, and a cell in that row, to a table if has a value:


 * Your way looks like this:

|- --Cogniac (talk) 21:13, 4 February 2011 (UTC)
 * style="background-color:#000000; color:#FFFFFF;" |
 * which would result in the row+cell being introduced into the table whether that parameter is filled in or not.

I'm not really understanding what you're asking - a practical example would be useful. are you talking about 5 sequentially nested templates, and you're trying to pass a conditional parameter down through the chain? -- Ludwigs 2 17:12, 4 February 2011 (UTC) --Cogniac (talk) 21:13, 4 February 2011 (UTC) Themeparkgc  Talk  21:39, 4 February 2011 (UTC) --Cogniac (talk) 22:40, 4 February 2011 (UTC)
 * My example was not referring to 5 sequentially nested templates, but rather 5 completely separate templates. However, I will attempt to describe a simple example using sequential nesting: Imagine you are making 2 templates for a particular type of object on Wikipedia.
 * The first template is used to display a labeled list of basic information about an object, possibly for use as a quick reference on related pages, or on list pages. Most, if not all, of the parameters in this template are conditional. Each instance of the object type may have a different subset of the information list. To use it, you fill in the parameters that correspond to what the object instance actually has, and you ignore the other parameters. (Crude Example: Say the object type is "Tool." A Hammer has a handle length, Sandpaper does not, so when using this template to describe Sandpaper, you wouldn't fill in the "|handleLength=" parameter.)
 * The second template would be the Infobox for use on the actual pages of that type of object. This template would be comprised of all the information contained in the first template, plus a picture of the object, all housed in a visually-pleasing box of some sort.
 * The obvious response would be to transclude the first template into the second template, and make it so filling in parameters in the second template would just pass them through to the first template. But since the parameters in the first template are conditional, you would have to write all of the conditional code over again in the second template. This means that not only would you not be eliminating redundant code, you would be making it twice as bad!
 * Then why not incorporate the image (and any other parts of the second template) into the first template and repeat them. It seems like in the end you'd have less repeated code.
 * Because the second template is an Infobox. Infoboxes go in the top-right corners of articles, not all over the place in list pages. When's the last time you saw a page that was just a list of Infoboxes? That's why the first template was just a list of the salient information: for use on pages where putting the whole Infobox would be stupid. But this whole point is moot as I'm about to post a bit of a mea culpa about this whole topic.

So, I just had a bit of an epiphany that was triggered by Kotniski's post. I made a template like this: It makes a table, and each parameter corresponds to a color-coded cell in the table. If you don't fill in one of the parameters, the corresponding cell isn't displayed. If you don't fill any of them, the whole table isn't displayed.

Then I made a template like this: It's another table, with a header and a cell in the next row that houses within it.

As it turns out, that totally works for passing through conditional parameters without having to re-implement the conditional code. The problem was that I just wasn't thinking about it in the right conceptual context. So in my original post above, where I put

I could have just put

and gotten the same effect.

So I guess the only thing I could complain about now is the fact that there's no way to access the parameters of through  without creating corresponding parameters in  like I just did above; I.e. you can't implement something similar to Inheritance (Java/C#/C++ style). And I'm not really sure that's even something that would be a good idea to have. --Cogniac (talk) 22:40, 4 February 2011 (UTC)
 * Yes, you're not the first person to wonder about this; I think it would be found generally quite useful to have such a thing. Although the template "programming language" is bad in so many ways that I think the developers have just about given up on it - it might be replaced one day with proper scripting, but meanwhile the devs have made it their mission not to improve the current setup (bizarre but true), denying us the use of even obvious improvements like string functions, so there isn't much point in asking them to fix minor inconveniences like the lack of inheritance.--Kotniski (talk) 09:09, 5 February 2011 (UTC)