Jump to content

Help talk:Template/Archive 1

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Archive 1Archive 2Archive 3Archive 5

Template tip section on my user page

I have noticed that less experienced users might notice that I create a lot of templates for my own use (see User:Will Pittenger/templates for a list). Those users might try to ask for a fix to their template (or for creation of a template they don't know how to start) on my talk page. In an attempt to encourage them to seek the correct locations, I wrote User:Will Pittenger#Tips on working with templates.

Does anyone see any changes I should make? I am not attempting to provide a complete tutorial; just explain common mistakes. Will (Talk - contribs) 08:26, 15 February 2007 (UTC)

It looks good. You might want to think about harmonizing it with {{Template doc page transcluded}} and {{Sample}}.

If-then

I skimmed/searched the article, but couldn't find anything to help me - is it possible to tell a template to look for an inputted value and if the value matches a predefined value, give a specific output? Specifically, I want to make a template (on another wiki) that puts a page in the Build: namespace in one of five (seven?) categories, but they're named quite differently. I was thinking I could make it so that if I say {{Build|Stub}}, the template would show that the page is a stub and add the page to Category:Stubs, whereas if I put in {{Build|New}}, it would add it to Category:New builds. (Note that these would entail different templates combined into one.) The biggest problem would be getting the code to put it in different percentage categories; we want the pages to be categorized by percentage, and the categories will be 0-19%, 20-39%, etc. Can I make it so that if I say {{build|0}} it'll put it in Category:0-19% builds, {{build|20}} in Category:20-39% builds, and so forth? While I have your attention, is it possible for a template to spit out the time it was placed on a page? I've tried messing with ~~~~~, nowiki tags around certain areas of the code (which just disabled the code until it got to an end tag), and {{CURRENTTIME}}, but nothing's helped.

Thank you for your help! -- Maethon (talk) 21:39, 10 May 2007 (UTC)

Template X2

The page transcludes {{X2}} which on m:Help:Template works fine but here it's a sandbox template. Jɪmp 01:33, 28 May 2007 (UTC)

Usage

In the section on usage it states "Templates are useful for any text for which one wants a copy in two or more pages, and there is no need for each copy to be edited independently to adapt it to the page it is in." In the recent deletion debate [here http://wiki.riteme.site/wiki/Wikipedia:Templates_for_deletion/Log/2007_August_29#Template:La_Martiniere_Song here] it was noted in particular that "Templates should not masquerade as article content in the main article namespace; instead, place the text directly into the article." I wonder if it might be advisable to change the wording of the usage section here because, in view of this deledtion debate the text as it currently stands is misleading and implies that it is acceptable to use templates for editorial text. Either that or the WP:TMP guideline should be changed. Dahliarose 15:29, 6 September 2007 (UTC)

The text is general for all MediaWiki wikis, except the section Wikipedia-specific help. The latter can be used for Wikipedia policy.--Patrick 16:36, 6 September 2007 (UTC)
Sorry I hadn't realised that was the case. Thanks for explaining. Dahliarose 19:48, 6 September 2007 (UTC)

Simpler, clearer explanations needed

Hi, I think this Help article is not really of much help to beginners at all. It uses far too much jargon and doesn't explain clearly how to use parameters or special operators such as #if and #switch. Is there another article that does this? If not, would somebody please simplify this article? Cheers, Jacklee 01:34, 19 September 2007 (UTC)

At the top it says: For an introduction, see A quick guide to templates and mw:Help:Templates.--Patrick 10:01, 19 September 2007 (UTC)

Yes, but those articles are too simple and don't explain the use of functions such as #if and #switch, which I see being used in other templates. What is needed is an article that explains in more detail the workings of templates, but with clearer examples and without the jargon. I am trying to create a template to display a link to an online version of the Singapore Constitution with the syntax "{{Singapore Constitution|full=|rep=}}" (see {{Singapore Constitution}}, which doesn't work properly at the moment). The purpose of the "full" parameter, which is intended to take a "yes" or "no" value, is for users to indicate whether they would like the full title of the Constitution ("Constitution of the Republic of Singapore") or an abbreviated title ("Singapore Constitution") to be displayed. However, I can't determine from this help article how to do so, or whether this can even be done. Cheers, Jacklee 12:18, 19 September 2007 (UTC)

That has little to do with templates: use #ifeq instead of #if.--Patrick 14:13, 19 September 2007 (UTC)

But surely that has everything to do with templates! How do I find out how to use #ifeq instead of #if? What does #ifeq even mean? Is there a full list of operators that begin with # somewhere, with instructions on how they should be used? This underlines my point that there needs to be a clear article somewhere explaining how all this works, otherwise there are just going to be a lot of broken templates out there. Cheers, Jacklee 14:22, 19 September 2007 (UTC)

See m:Help:ParserFunctions. It is linked from this help page.--Patrick 14:31, 19 September 2007 (UTC)

Oh, right. I didn't even realize those were called parser functions. Thanks. Anyway, I hope you look into my feedback about clarifying and simplifying this article. Cheers, Jacklee 05:28, 20 September 2007 (UTC)

I agree. I already understand these things a bit, but wanted a little clarification since one of my template additions is not behaving, and I left more confused than when i came.--Esprit15d(۝۞) 13:28, 8 November 2007 (UTC)

passing a table

I am setting up templates for a wiki we are establishing where i work. We are using the templates because many people will be contributing and we want to keep a consistency throughout the pages. The template is used to establish section headers with data being passed to populate the text under the section.

One of the sections contains a table.. when the table is passed to a variable it shows up as simply an opening curly bracket, nothing else in its contents appears.

I've found references to double curly brackets being passed but nothing saying that a single would cause problems.

Can anyone tell me if it is possible to pass a table as a variable and if so, what i am doing wrong?

The code i am using for the template is as follows:

==Section 1 Header==

{{{data0|}}}

==Section 2 Header==

{{{data1|}}}

==Section 3 Header==

{{{data2|}}}

==Section 4 Header==

{{{data3|}}}

==Section 5 Header==

{{{data4|}}}

==Section 6 Header==

{{{data5|}}}

==Section 7 Header==

{{{data6|}}}

The page that calls the template contains the following:

{{Design Review|data6=

{|

|-

|Test

|}

}}


Caile13 21:13, 12 November 2007 (UTC)

Encode the "|" of the table syntax as "{{!}}", see Template:! (backlinks edit).--Patrick 00:20, 13 November 2007 (UTC)

Ok.. i found the page you are talking about but it appears to reference anther template that, since we are using our own instantiation of a wiki, we don't currently have. i was going to try to build it but when i try to view source... things get really confusing. am i correct in thinking that i need to set up a special template to get the {{!}} to work in place of "|" ? Caile13 15:02, 13 November 2007 (UTC)

Yes, but it only needs to contain "|", the rest is documentation.--Patrick 00:53, 14 November 2007 (UTC)

Categories and templates

I'm having some trouble with categories and templates. There are some templates on Eurovision pages that automatically categorize any page with the template in a certain category. The problem is that it is the wrong category. How do i add something or change something in these templates to make the pages who have them be in the right category? I also want to add some categorizers to some templates. For example, I want all pages having this template [1] to be in Category:Sweden in the Eurovision Song ContestGrk1011 (talk) 22:32, 19 January 2008 (UTC)

Lanlp 1 defunct?

Template:Lanlp 1 is given as an example of repitition, and indeed that is the case on meta, but the wikipedia version is just a URL as of October. What's the correct thing to do? jhawkinson (talk) 14:33, 25 January 2008 (UTC)

I restored it.--Patrick (talk) 00:53, 26 January 2008 (UTC)

WPSI Template help

There is an annoying glitch with the comments section of Template:WPSI. Sorry if I am being dense, but can someone tell me how I can find some technical help with this? Thanks. Ben MacDuiTalk/Walk 12:12, 30 March 2008 (UTC)

Has this been resolved? what is/was the glitch?--Ludwigs2 19:03, 25 July 2008 (UTC)

Plural if more than one parameter

I need a way to change a word in a template to plural if more than one parameter is passed. Does anyone know how I would do this? Any ideas? Kaldari (talk) 19:01, 16 April 2008 (UTC)

If you are using parameters the normal way (not named) so they come in as numbered parameters, then you can do as they do over at the {{shortcut}} template:
Shortcut{{#if:{{{2|}}}|s}}
Which renders "Shortcut" if only one parameter and "Shortcuts" if two or more parameters.
--David Göthberg (talk) 00:02, 17 April 2008 (UTC)

Starting a parameter value with an asterisk

Resolved

Whenever I start a parameter value with an asterisk, it is not formatted as a list item. It's not converted at all. Surely there's a way to have lists passed in as parameter values? See here as an example -- Charles (Kznf) (talk) 14:36, 2 May 2008 (UTC)

Bullet markup must be in the first column. You need a break before the first line. I added one for you. --— Gadget850 (Ed) talk - 15:19, 2 May 2008 (UTC)
Of course it does! I'm an idiot. Thank you. Charles (Kznf) (talk) 20:15, 2 May 2008 (UTC)
You are welcome --— Gadget850 (Ed) talk - 21:03, 2 May 2008 (UTC)

Problems with the new WikiProject Soviet Union template

In an effort to improve WikiProject Soviet Union, I have undertaken a task over the past few days to lay the groundwork for an improved project template by adding class= and importance= parameters to the templates on the talk pages of each article in the scope of the project. After this was completed, I attempted to modify the template (using Template:WP conlangs as a guide - the new template is essentially a clone of it - it is also important to note that the WP conlangs template works flawlessly) so it would display the newly-embedded information and sort the tagged articles into categories based on class and importance. While the modified template looked good with both class= and importance= left blank (i.e. the way it appeared in the template page itself, which has now been moved to a sandbox on my user page), all talk pages to which the new template had been attached to appeared strangely deformed, with certain parameters outside the template's space. In general, it was simply messing up the talk page. The sandbox, and the attached doc file, are exact copies of the faulty, new WP Soviet Union template. The template itself has been reverted to its previous state, but its history still contains the faulty version. If anyone can help me in resolving this project or helping me find someone who can help, your assistance would be greatly appreciated. Thanks! TFCforever (talk) 22:51, 3 June 2008 (UTC)

Replied on user talk page. Just some trouble with noinclude tags. JackSchmidt (talk) 01:42, 4 June 2008 (UTC)

Parameter names should follow CSS standard

Most formatting parameters are translated internally into CSS properties. I suggest Help:Template should be edited to:

  • say that names of formatting parameters should follow the CSS standard property names or be easily understood abbreviations of these. For example a parameter that specifies a background color should be called background-color or bg-color.
  • say that names that are equal to or similar to those used in the CSS standard should be used only for the purposes described in the CSS standard.
  • link to a page (external or internal) that lists all the CSS keywords, so that template writers know which names they should not use for other purposes. Philcha (talk) 18:14, 23 June 2008 (UTC)

Most of the examples are unreadable

Because they do not use white=space, line-breaks, indentation and the other visual cues that most development groups insist on. Philcha (talk) 12:51, 24 June 2008 (UTC)

Passing parameters through to inner templates

Is it possible for a template "call" to pass parameters through to inner templates? The specific case I have in mind is Template:Annotated image, which contains a variable number of uses of Template:Annotation to insert notes into an image. In this case I'd like "calls" to Template:Annotated image to be able pass default values of formatting parameters to the instances of Template:Annotation - these would be used in all the contained instances of Template:Annotation, except where over-ridden for specific instances. Philcha (talk) 00:28, 26 June 2008 (UTC)

The calls of Template:Annotation are in the expression for a parameter value in the call of Template:Annotated image. This expression is evaluated independent of other parameters of Template:Annotated image. However, an outer template like Template:Annotated image/Extinction could pass a parameter to both.--Patrick (talk) 04:28, 26 June 2008 (UTC)
I'm not sure what you mean here, and realise that my query should have been more explicit. What I'd like is e.g.:
  • {{ Annotated image | image=someImage.png ... | annot-color=red | annotations={{ Annotation | ... }} {{ Annotation | ... }} .... }}
  • all of the contained calls to Template:Annotation pick up annot-color=red and display the annotation text in red, except where I over-ride this for specific annotations.
Is this possible? Philcha (talk) 09:59, 26 June 2008 (UTC)
It is not related to templates, but I think an inner div can override the text color specified in an outer div.--Patrick (talk) 05:53, 27 June 2008 (UTC)
One would have to adapt "annotated image" to use parameters "Annotation1=", "Annotation2=", "Annotation3=", with the accompanying "Annotation1-align=" - which would be a nightmare. But as Patrick says, the use of a container DIV would do what you want it to - I'll start implementing the change and you can complete it as you wish. Martin (Smith609 – Talk) 10:30, 28 June 2008 (UTC)

Suppress display of template on doc pages

How can I suppress the autmotic display of a template at the foot of the doc page? I want to put a few simple exmaples in the doc page and display the results floated alongside. Philcha (talk) 09:06, 1 July 2008 (UTC)

can you give an example of what you mean? your question isn't clear to me. --Ludwigs2 22:27, 25 July 2008 (UTC)

Template

I was recently told by two different people that, a) there is a limit on the number templates a page may have (including any templates used internally by other templates) and, b) the wiki will stop processing templates if it takes longer than 30 seconds to evaluate them. Which is true, or are both statements accurate? Also, does the 30 second limit apply to a single template or the sum of all templates in a page? Thanks! SharkD (talk) 23:50, 19 July 2008 (UTC)

I don't believe there's a theoretical limit to the number of templates that can be transcluded, but you'll have pragmatic limits imposed by wikipedia and your browser (30 seconds for template processing, a minute, usually, for browser time-out).

question about Meta

Per the template at the top of this page, edits should be made to the page at Meta. however, the version here differs significantly from the one at meta, so someone has been editing here extensively. is there something I don't know about?  :-) --Ludwigs2 22:18, 25 July 2008 (UTC)

  • Unfortunately, I think it's just that most people don't read the note. I often copy & paste the Meta version over the Wikipedia version, and I don't have time to comb through to see what people changed in the WP version, so those edits get lost. Libcub (talk) 03:46, 26 July 2008 (UTC)
well, I think this version is an improvement over the meta version, so I may copy and paste it over there so it doesn't get lost, and then add the revisions I'm thinking of. it doesn't seem as though the meta page gets copied over often, though (maybe it's only triggered when there's a change meta-side). --Ludwigs2 19:34, 26 July 2008 (UTC)

Help creating template

I seem to recall there being a place to find a list of users who are good with templates that you can ask for help, but for some reason I can't seem to find it. I'm sure it's there and I'm just missing it. Can anyone point me in the right direction? Or you could just offer to help if you're knowledgeable and available.►Chris NelsonHolla! 02:34, 1 August 2008 (UTC)

what you want is here, I think - Wikipedia:Requested_templates. --Ludwigs2 20:19, 4 August 2008 (UTC)

Passing parameters by another template

Is there any way to pass parameters from another template? Here's what I'm thinking:

{{DoStuff1
{{Values}}
}}

where Values is:

|Var1 = ...
|Var2 = ...
|Var3 = ...

This though, doesn't work multiple reasons:

  • For starters, DoStuff isn't recognized as a template unless I do
{{DoStuff1
| {{Values}}
}}
  • However, when I do this, he interprets {{{1}}} as the entire Template:Values template, and not different variables.

I'm trying to get this to work, as I have multiple templates that take the same input parameters. Rather than changing all those templates when a change occurs, I want to just change the Template:Values template...
Also, I have a few templates that would take variables from Template:Values1 and Template:Values2.

Can anybody help? I looked into subst, which can be a work around, but in the end, I still have to go around all the templates manually every update. Anyone got a clue? happypal (Talk | contribs) 18:34, 3 August 2008 (UTC)

I'm not clear on the exact problem you're facing, but in general this is not too difficult. see m:help:advanced_templates. basically what you end up doing is placing the output of one template as the input of another, as in {{T1|parameter1={{T2}}}}. if you're trying to pass several parameter values at once that might be a little more difficult - I'd need a clearer idea of what you want to accomplish to figure out if and how it could be done. --Ludwigs2 20:28, 4 August 2008 (UTC)
In a template call parameter definitions have to be separated by raw pipes (raw means here: in the wikitext, not just in the expanded wikitext), see Help:Template#Parameters, so a template cannot produce multiple parameter values with pipes.--Patrick (talk) 21:42, 4 August 2008 (UTC)

Switches on templates - Please help

Hello. I'm a beginning wiki editor, and I have a wikia account which is just starting. I was wondering how to create a template that will categorize a page a particular way when asked. It's Guild Wars related, if you would like yo know. Here's how it breaks down.

There is a base template, say {{guild}}. I want it able to be discernible with several different categories. Something like {{Guild|PvX}} will automatically place it in the [[Category:PvX Guilds]]. At basic level, I would like to do so with these:

  • PvE
  • PvX
  • PvP

It would be awesome if I could get subsets of each category too:

  • PvE
    • Recruiting
    • Inactive.... And so on.

My question to you is how should I best do this? Thanks for listening. --67.119.193.93 (talk) 03:44, 7 August 2008 (UTC)

It's not difficult, for example this should do the basic job without the 2nd level ("Recruiting", etc.):
[[Category:{{{1|}}}Guilds]]
{{{1|}}} means "use the value of the first (un-named) parameter; if not supplied, output nothing". The disadvantage of this approach is that you have to remember the values, as the template doesn't check it.
I think a template is an unnecessarily complicated approach because you have to remember the valid values and code the template call {{Guilds|PvE}} correctly. Once you have the top-level category page, e.g. "Guilds", you could just put a link to it on your user page. Then you can look it up, copy the appropriate sub-category and paste it into the article. -- Philcha (talk) 05:02, 7 August 2008 (UTC)
you should also look through Parser Functions - the #switch: command might be useful for the kind of thing you're after. --Ludwigs2 21:53, 7 August 2008 (UTC)
Look at {{Non-free Scout logo}}. --—— Gadget850 (Ed) talk - 22:47, 7 August 2008 (UTC)
Hey cool, the switch works out for me - but when I try to place a second switch (recruiting = recruiting), the category gets messed up as "Category:RecruitingPvX Guilds" with the words jumbling together. Any way to fix this? Here's the code:
[[Category:{{#switch: {{{1|}}}|PvE = PvE|PvP = PvP|PvX = PvX}} Guilds]]

While the malfunctioning one is this:

[[Category:{{#switch: {{{2|}}}|Recruiting = Recruiting}}{{#switch: {{{1|}}}|PvE = PvE |PvP = PvP |PvX = PvX }} Guilds]]

Thanks. --People of Antioch (talk) 21:36, 8 August 2008 (UTC)

it's (again) not clear what result you're looking for here. remember, a category is just a wikipedia page that is used as a category list, and all you're trying to do with the switch is construct the correct page name character by character. so if what you've given above shouldn't have the words run together, then put a space in - e.g.:
[[Category:{{#switch: {{{2|}}}|Recruiting = Recruiting}} {{#switch: {{{1|}}}|PvE = PvE |PvP = PvP |PvX = PvX }} Guilds]]
it would really help if you could give an idea of the exact page structure that you're trying to reference. --Ludwigs2 00:44, 9 August 2008 (UTC)
Just a simple way of categorizing a page. It's located here. I tried spacing out the characters, but (it may just be a wikia thing) it doesn't seem to work out that way. I'm a little unclear on what you want me to clarify on, however (sorry!). --People of Antioch (talk) 02:38, 9 August 2008 (UTC)
PoA - I go to that page, and it doesn't say a darned thing about 'recruiting', 'inactive' or any other special page. you are telling us that the formula you're making doesn't create the right page names, but you are not telling us what the correct page names should be. basically you're saying "fix it, it's broke", but you're not telling us what 'it' is.
you can try using and underscore "_" or a non-breaking space "$nbsp;" instead of the space I used; that might work. --Ludwigs2 05:10, 9 August 2008 (UTC)
Oh! How stupid of me. It should be "Category:Recruiting PvX Guilds", "Category:Recruiting PvP Guilds", or "Category:Recruiting PvE Guilds". Anyway, the underscore worked out for me. Thanks for your help and the new bookmarks (cheat sheets ^_^) you gave me. People of Antioch (talk) 16:45, 9 August 2008 (UTC)

Hide/Show

I have a template which defaults to show and i'd like it to default to hide? Operating (talk) 20:51, 2 September 2008 (UTC)

errrr... can you be more specific? maybe a link to the tempalte would help. --Ludwigs2 22:01, 2 September 2008 (UTC)
Ah yes. Its here Template:Laurel and Hardy. It takes up a lot of room, and seems to be permanently on show. I've tried looking at it logged in and out of my account, to test whether it does default to show. Perhaps i'm missing something. Operating (talk) 22:32, 2 September 2008 (UTC)
I've fixed it. all it needed was the 'state=collapsed' parameter. --Ludwigs2 23:38, 2 September 2008 (UTC)
Ah good. Regards. Operating (talk) 23:47, 2 September 2008 (UTC)

I'm wanting to add a listas parameter to this template, as one does not exist on it at the moment, which makes it more difficult to manage as well as counter to other biography template functions. However, I'm totally clueless about how to edit templates. Help? Thanks! Wildhartlivie (talk) 00:06, 15 September 2008 (UTC)

what is this 'listas' parameter supposed to do? I have no idea how this tempalte is used, or what the change you're trying to make is. --Ludwigs2 01:08, 15 September 2008 (UTC)
It's a default sort function that is used in Template:WP Biography. The biography subject's name is put in the project template as listas=Dow, John so that it is properly alphabetized by last name in category listings. I'm not sure why Template:WP Criminal doesn't have this parameter, but it's routinely used on that project. Wildhartlivie (talk) 03:37, 15 September 2008 (UTC)
 Done ah, gotcha. I've added it in; may take a while to work its way through the system. if it doesn't work quite right let me know, but it should be non-problematic. --Ludwigs2 17:18, 15 September 2008 (UTC)
Thanks so much! Wildhartlivie (talk) 17:22, 15 September 2008 (UTC)

Template help

How might I make a template that does both of the following:
This:

{{TemplateThatNumbersNames|Joe|John|Mary}}

would yield:

Number Name
1 Joe
2 John
3 Mary

while:

 {{TemplateThatNumbersNames|Joe|John|Mary|Sam|Sandra|Sue|Dave|Marcus Brutus}}

would then yield:

Number Name
1 Joe
2 John
3 Mary
4 Sam
5 Sandra
6 Sue
7 Dave
8 Marcus Brutus

Basically, the template forms new rows for each new name, and numbers each new row accordingly. Is a template like this possible to create? Thanks for your help, αЯβιτЯαЯιŁΨθ (talk) 23:06, 29 September 2008 (UTC)

it's certainly possible to do this (there's a for-type loop template somewhere...) but I can't see the advantages of doing it. it would be just as easy to add in the rows by hand, or construct them using a good text editor and regexp. what's your bigger goal, here? --Ludwigs2 23:51, 29 September 2008 (UTC)
Thanks for asking Ludwigs2. I was hoping to create a template that could list and organize articles created by a user that is easy to use. I made one for myself, but as you can see, the source code is very long (about 5kB) and it is difficult to add articles onto. My hope was to create a chart like this through a template, by simply typing:
{{TemplateNameHere|Article 1|Article 2|Article 3|etc...}}
That way, it could easily be used by other users as well. So, in what way can this be done (refering back to my original question: {{TemplateThatNumbersNames|Joe|John|Mary}})? Thanks again for your help, αЯβιτЯαЯιŁΨθ (talk) 00:13, 30 September 2008 (UTC)
I may not be quite understanding what you're after, but it sounds like what you're after is a category page just for the articles you've created. either that, or a bot that will extract them out of your edit history...? let me give it some thought. --Ludwigs2 00:38, 30 September 2008 (UTC)

where are the interwiki links? at the begining of the article there are only two (:ro and :es). where are the others? Ark25 (talk) 18:00, 5 October 2008 (UTC)

In Template:Ph:Template.--Patrick (talk) 22:47, 5 October 2008 (UTC)

Template Help

Hi, i revamped a template recently at Template:TUGS. I used the code from Template:WikiProject Ships and tried my best to make some sense of it by editing out the bits i didn't need and replacing the pictures. But, as you can see from this edit, it didn't quite work out right. Can anyone tell me what went wrong? I should have heeded the esoteric warning...--SteelersFanUK06 ReplyOnMine! 11:56, 13 November 2008 (UTC)

- Fixed your template for you Cabe6403 (TalkSign!) 12:12, 13 November 2008 (UTC)

Question

Hello, is there a place I can ask questions about templates? I can't get the User UBC template to work the way i want it to. It works fine for the default case but for the cases with a modifier (like "alum") it changes the colour of the left side of the template... (The problem is demonstrated on the talk page of the template) TastyCakes (talk) 22:52, 13 November 2008 (UTC)

Fixed it for you Ronhjones (talk) 01:49, 4 February 2009 (UTC)

Template usage on Userpages

Hi, i've created a template at Template:TUGS-Member, to be placed on a user's userpage if they contribute to the TUGS WikiProject. For some reason, when this is done a message flags up telling me that the page should be moved to the user's talk page. But it shouldn't, that's not what its for. The only option round it is to add parameter "|category=no", but we don't want to do this either as this would remove them from Category:WikiProject TUGS participants - as well as mean that the user would have to add the category parameter on to the template every time it was added by a new user. Some examples of the template flagging up a problem can be seen at User:FelixCheng, User:Rusty5, User:PercytheGreen. What is the problem? --SteelersFanUK06 ReplyOnMine! 17:13, 20 November 2008 (UTC)

Went to help desk, problem fixed. Thanks anyway --SteelersFanUK06 ReplyOnMine! 02:15, 6 January 2009 (UTC)

redirect to a template with the addition of a parameter

Hi. I made a new template called template:Infobox EU legislation, which is designed to merge template:EU regulation and template:EU directive. To make this merge come about I need some sort of a redirect from template:EU regulation and template:EU directive to template:Infobox EU legislation, but with the addition of another parameter ("regulation=1" for template:EU regulation and "directive=1" template:EU directive). The addition of the parameter is not a problem, but how do a forward the original parameters of template:EU regulation? I'm currently trying to establish something at template:EU regulation. Maybe some expert can help? Fentener van Vlissingen (talk) 23:11, 1 December 2008 (UTC)

The two original templates are not used in many articles. Just change the infobox in each article and add the appropriate parameter. --—— Gadget850 (Ed) talk - 23:42, 1 December 2008 (UTC)
I'm being helped already, thanks for the comment! Fentener van Vlissingen (talk) 00:06, 2 December 2008 (UTC)

How to make template appear below rather than next to another item on the page?

At Vocal pedagogy and Vocal register, how would I make the Voice Type template appear below the first item at the upper right? Whatever404 (talk) 14:58, 8 December 2008 (UTC)

Help with infobox publisher

I hate to dump this on a talk page, but is there a template wizard who can help me with {{infobox publisher}}? The country of origin parameter isn't showing up even though its filled out. Also, there were originally two documents - infobox publisher and infobox Publisher (capital P), I redirected the latter to the former, but lost some fields in the process (here is the diff and here is the previous version). WLU (t) (c) (rules - simple rules) 22:59, 10 December 2008 (UTC)

Where is this not working? Andy Mabbett (User:Pigsonthewing); Andy's talk; Andy's edits 20:41, 28 December 2008 (UTC)
Because you are using the wrong name for the passed parameter. The template requires country =, your blank template shows country of origin =. See my sample edit on Prometheus Books, which now works OK Ronhjones (talk) 01:23, 4 February 2009 (UTC)

Hijacked ship‎

Some help is needed, please, converting {{Hijacked ship‎}} (whose intricacies are beyond me) to use {{Start date}}, as discussed on its talk page. Andy Mabbett (User:Pigsonthewing); Andy's talk; Andy's edits 14:09, 29 December 2008 (UTC)

Various Cher templates

An editor has made a bit of a mess of templates for Cher songs and I can't quite sort it out. I'm not sure if he originally created Template:Cher songs, but he moved it to Template:Cher songs part 1 and also created Template:Cher songs Part 2. In the process, he also created Template:Cher singles (1965-1982)(navbox), which had errors, so he abandoned it (I've since nominated it for deletion). One of the problems, besides few of the songs in the templates having the template, is that with the templates on the Cher page when one clicks view on either template, it goes through a redirect from Template:Cher songs instead of directly to the correct template. Then today, he decides he wants to change the name of the Template:Cher songs Part 2, so he creates a new template, Template:Cher songs (1987-2009, which had an obvious error, so rather than request a name change/move the page, he created yet another new template, Template:Cher songs (1987-2009). Then he went in to the Cher page and changed the template name. I've nominated the new one with the error for nomination and redirected the second new one to the original Template:Cher songs Part 2. I changed back the template name on the Cher page to the orginal Part 2 template. The problem is, I'm overwhelmed. I don't know enough about all of this to fix the current templates on the Cher page so that one isn't redirected through the old, single template. When all of this is sorted out, I'll put the appropriate template on the song pages. Meanwhile, the editor split the Cher discography page into two separate pages, Cher singles discography and Cher albums discography but didn't changed the links in any of the templates (though I've fixed this). Help!! Wildhartlivie (talk) 05:11, 22 January 2009 (UTC)

Do you really need templates that duplicates the lists? Take a look at The Beatles and see the template there. --—— Gadget850 (Ed) talk - 14:59, 22 January 2009 (UTC)
Personally, I am not a fan of the ever-growing template farms at the bottom of articles. I'd be happy to dispose of the majority of the ones I see. I didn't create any of the Cher templates, I was just trying to clean up behind someone who obviously either didn't know what he was doing or didn't care. Having said that, if they are to remain, they need to be cleaned up after, which I don't have the coding skills to do. Wildhartlivie (talk) 01:21, 23 January 2009 (UTC)

So is there someone who can help me sort out the problems the editor left in all the templates so that they don't go back to something else? Please? Wildhartlivie (talk) 02:16, 24 January 2009 (UTC)

Page does not help a new user

Hi. I am a new user. I was browsing through the help pages. I found that the help page starts from 'transculation' or something. For a new user I think it should start from what a template means and how to apply it. Dheerajakula (talk) 18:09, 28 January 2009 (UTC) —Preceding unsigned comment added by Dheerajakula (talkcontribs) 18:07, 28 January 2009 (UTC)

Perhaps http://wiki.riteme.site/wiki/Help:A_quick_guide_to_templates would help? Kenpem (talk) 01:03, 4 February 2009 (UTC)

When parameters do not expand

Parameters do not get expanded when they are inside nowiki tags or XML-style extension tags.

Is there any sensible way to work around this? For example:

{{Template:Query|Q=rep_StockStatus}}

where the template code is:

<include nopre noesc src="https://my.domain.com/FetchData?q={{{Q}}}" />

which should expand to:

<include nopre noesc src="https://my.domain.com/FetchData?q=rep_StockStatus" />

but does not, the PHP code doesn't get parsed data, it sees https://my.domain.com/FetchData?q={{{Q}}}, which is pretty useless.

Kenpem (talk) 01:03, 4 February 2009 (UTC)

errr... I'm thinking that's probably not allowed by the parser. wikipedia pages don't allow certain kinds of HTML (mostly links and such) at all, and probably doesn't allow direct php code processing. this is to keeps spammers and hackers from hijacking links and pages for their own purposes. --Ludwigs2 01:40, 19 February 2009 (UTC)
Did you try this?
<nowiki><include nopre noesc src="https://my.domain.com/FetchData?q=</nowiki>{{{Q}}}<nowiki>" /></nowiki>
Peter (talk) 15:08, 16 March 2009 (UTC)

Jargon cleanup

I'm happy to start on this (I'm usually pretty good at cleaning up jargon) but shouldn't this be done on the main mediawiki version? or doesn't that matter? --Ludwigs2 05:21, 24 February 2009 (UTC)

@ Patrick - corrections

Patrick, re: this corrections you made - [2]. I'd added that blurb because of this discussion Help:Template#Troubles with noinclude. did I misunderstand? your other corrections have been spot-on, so I probably goofed up here as well; I'd just like to see it more clearly. --Ludwigs2 20:25, 4 March 2009 (UTC)

Help with templates having seemingly erroneous symbols?

Not sure how to explain this, but what I can do is point you to, for example, Template:NBA game log section, which shows at the top this: |}
Now I'm wondering why that's there, since I can't find any mistake in the text of the template's article. And I've seen this in other templates and can't get rid of it - but I believe it should not be there. Please help! thanks ~ GoldenGoose100 (talk) 21:16, 1 March 2009 (UTC)

well, that particular construction looks like a broken table (those characters are how tables usually end). in the particular case of the Template:NBA game log section, it's because someone placed 'noinclude' tags around the opening {| of the first table. I have no idea why they would do that - let me see if I can straighten it out, and you can see the changes in the template page history. --Ludwigs2 21:51, 1 March 2009 (UTC)
ugh, well, it looks like this template was built by someone who doesn't 'get' portable code. what's happening (as near as I can tell) is that this template is of a set of connected templates, such that when all of them are put together they make one big table in the target article. start of the table is in one template, end of the table is in another, other templates have center pieces... ugly, ugly design, but I suspect it's way too involved to fix without a whole lot of effort. --Ludwigs2 22:01, 1 March 2009 (UTC)
Well... thanks for your effort in trying Ludwigs - peace ~ GoldenGoose100 (talk) 17:58, 2 March 2009 (UTC)
Looks like the <noinclude>...</noinclude> should have been <includeonly>...</includeonly>. The {| is not supposed to be part of the template, but the author wanted the table row to display neatly on the template page. Looks like the table header should be {{NBA game log start}}, then the table rows are built with {{NBA game log section}} and then the table is closed with {{NBA game log end}}. If you want to clean this up:
  • Create a documentation page for {{NBA game log section}} and merge the documentation for all three templates
  • Add {{documentation}} to all three templates, redirecting the other two to the first.
  • Wrap all the templates in <includeonly>...</includeonly> so they look ugly on the template pages
  • Create examples in the documentation
Templates like this are rather messy, but they do have the advantage of allowing neophytes to edit the article without understanding table code. --—— Gadget850 (Ed) talk - 18:36, 2 March 2009 (UTC)
there is that; but the programmer in me screams 'there has to be a better way'. ah well... --Ludwigs2 21:47, 2 March 2009 (UTC)

Easy template problem

The template I'm having problems with is Template:PhylomapA. It's pretty straightforward, but I can't figure out why the parameters aren't working. There's a demo at my sandbox. I'm sure it's something silly, but any help is appreciated! a relevant page is the ImageMap explanation at mediawiki. -ΖαππερΝαππερ BabelAlexandria 01:27, 3 March 2009 (UTC)

well apparently it wasn't that easy.... oh well, figured it out for myself after looking at how {{imagemap}} does it. I apparently needed to use {{#tag:imagemap instead of <imagemap> tags. -ΖαππερΝαππερ BabelAlexandria 06:30, 6 March 2009 (UTC)


For [3], it might not be necessary to mention any variations with named parameters, as this section starts out with unnamed parameters. Really minor point though.

Congrats to the re-writer of the page. Last time I was looking for something (here or on Mediawiki), I had a really hard time to find anything in the documentation.

BTW for version 1.2.6, wasn't it initially thought that, in general, templates were to be substituted? -- User:Docu

good point on the first; I'll fix that. and than you.
I don't know anything about the MediaWiki history, so... --Ludwigs2 01:25, 12 March 2009 (UTC)

WikiMedia => Wikipedia ?

Should references to "WikiMedia" be changed to "Wikipedia"? It reads "WikiMedia" as this page was written for/at m:Help:Template. -- User:Docu

eh, honestly I was thinking of moving big chunks of this over to m:Help:Template (since the original here was just a copy of that page anyway, and the issues are the same). I'd considered porting it to mw:Help:Templates, but HappyMelon seems to think that would violate licensing terms; plus, I'm having a hard time figuring out what the relationship between the three pages is supposed to be. . long story short, I said MediaWiki mostly because I was thinking in general terms as I edited. does that make any sense? --Ludwigs2 22:24, 12 March 2009 (UTC)
It does. It would be easier if we had just one version at mw:Help:Template. We'd spend less time figuring out which version is how outdated .. -- User:Docu
To include any work from here in mw:Help:Template, you must release your edits to Public Domain. A simple statement here will suffice. Another issue is that there are many differences between vanilla MediaWiki, the English Wikipedia and the Wikipedia sister projects. Some templates depend upon custom CSS or JS peculiar to the English Wikipedia. --—— Gadget850 (Ed) talk - 17:09, 30 March 2009 (UTC)

help w table

I'd like the last line of the table in {{Infobox Bantu name}} to not appear unless it is filled. I've tried doing this with if: parameters, based on existing templates, but can't get it to work properly. Can anyone help? kwami (talk) 06:10, 25 March 2009 (UTC)

 Done let me know if that's not what you wanted. --Ludwigs2 06:38, 25 March 2009 (UTC)
Thanks! Perfect. I hadn't understood about {{!}}. kwami (talk) 07:09, 25 March 2009 (UTC)
yeah, that's a tricky bit. --Ludwigs2 16:02, 25 March 2009 (UTC)

Todo

A few suggestions:

  • Using references within a template; see Help:Cite errors for more info
  • Using categories within a template, including category suppression

I will add more as I think of them. --—— Gadget850 (Ed) talk - 17:11, 30 March 2009 (UTC)

DL Template Help

I am trying to edit this template in order to fix some redirects. Could someone please give me a hand and help explain how I would go about doing that?MusicInTheHouse (talk) 19:18, 18 April 2009 (UTC)

I'm not sure what you mean. do you want to merge this template with another template and redirect the other over? do you want to fix double redirects to this template? --Ludwigs2 21:24, 18 April 2009 (UTC)
There are links on the templates that link to redirects and other templates too. I just don't know how to edit templates and was hoping someone could quickly explain how I go about editing templates such as the one above. When I click on edit for example none of the countries or links appear just programming sentences or whatever they are. I appreciate any help then I'd be on my way.MusicInTheHouse (talk) 21:56, 18 April 2009 (UTC)
Ugh. I just followed one of the redirects back (Republic of Ireland, which redirects to Ireland), and fixing it directly is risky. what happens is that {{Driving licences in Europe}} calls {{Europe topic}} - a master template for those kinds of templates - and Europe topic calls {{Iso2country}} through a redirect from {{i2c}} to get specific page names for European country links. because of the way this is structured, changing the page name on the Iso2country template could make redlinks or break templates across a broad range of pages, and I don't know enough to mess with it. I suggest you leave a note on template_talk:Iso2country, or on the talk pages of one of the people that created that template. if you're having an immediate problem with double redirects, point me to where it's happening and I'll fix it, but anything more long term is going to have to come from them. --Ludwigs2 01:12, 19 April 2009 (UTC)
Thanks for the explanation. I didn't realise it was that complicated. I will do as you say, but as the main Republic of Ireland page is due to be moved soon I shall wait until that is sorted out until I ask people to fix it for consistency's sake.MusicInTheHouse (talk) 13:06, 19 April 2009 (UTC)

Help with an aspect of making a template

Hi, I hope this is in the right place! I recently made a template located here, and was wondering how I could make the three subsections of "Associates" align to the right, so that each sub-list begins un-staggered. I think that I have seen this used on templates before, but I could not find an example to copy when searching for pages I hoped would have complex templates on... Antienne (talk) 02:16, 2 May 2009 (UTC)

what do you mean by the three subsections of "Associates" align to the right, so that each sub-list begins un-staggered? I don't see anything I would call 'staggered' in the first place, and aligning the entire contents of that cell to the right would look... odd. please be as specific as possible in describing what you're after. --Ludwigs2 02:29, 2 May 2009 (UTC)
are you after something like this? --Ludwigs2 02:31, 2 May 2009 (UTC)
Hi, sorry for being unclear: I am trying to make it line up like edit I have made in the following image: http://img224.imageshack.us/my.php?image=97042928.png The coloured box is unimportant, but the example I recall seeing on WP somewhere I think used a coloured box like that. It is also unimportant whether the sub-headings are aligned to the right like the main headings, as long as the lists themselves all begin at the same point (evenly). I hope this is clearer. Antienne (talk) 02:38, 2 May 2009 (UTC)
Oh wow, yes, your second post has exactly what I am looking for! Thank you very much! Antienne (talk) 02:39, 2 May 2009 (UTC)

Unquoting a parameter value

The 'lc' and 'uc' functions are very useful for changing case. Is there a simple method for removing quotes from a parameter value? Thanks! Plastikspork (talk) 21:09, 9 May 2009 (UTC)

easy one

I'd like to add an optional page parameter to a ref. template, {{SOWL}}. Help:Extension:ParserFunctions does not seem to cover this that I can see, though I'm probably only off by a pipe or two. Can someone take a look? Thanks, kwami (talk) 07:03, 11 May 2009 (UTC)

Could you give an example? Do you want something like {{SOWL|page=12}}? Checking the edit history, it looks like this problem has been resolved? Plastikspork (talk) 15:29, 11 May 2009 (UTC)
Yes, perfect. Could you tell me what the general function of the pipe in {{{1|}}} is? Thanks! kwami (talk) 16:18, 11 May 2009 (UTC)
Sure. In general, if you see {{{1|foo}}}, this will be replaced by the 'first unnamed parameter', if it exists, and foo if it does not exist. So, in your template, if someone writes {{SOWL|12}} then the {{{{1|}}} is replaced by 12. However, if they write {{{SOWL}}} then the {{{{1|}}} is replaced by nothing. You can do the same thing for "named parameters". For example, if you wanted to allow for {{SOWL|page=12}}, then you could use {{{page|}}}. And finally, if you wanted to allow for both optional methods for specification of a page number, you could use {{{page|{{{1|}}}}}}. The only reason for using named parameters would be if you wanted to have multiple options and didn't want people to have to specify them in the correct order. Plastikspork (talk) 18:51, 11 May 2009 (UTC)
Thanks! And here I was trying to work in #if. kwami (talk) 18:55, 11 May 2009 (UTC)
You could have used an '#if' statement, but that would have been unnecessarily complicated in this particular case. However, it could work to use something like {{#if:{{{1|}}}|{{{1}}}}}}, instead of {{{1|}}}. Plastikspork (talk) 20:59, 11 May 2009 (UTC)

Searching pages for template usage

Is there a way to do a search to see what pages are using a specific template (like Template:Star Trek for example)? Aatrek (talk) 20:33, 11 May 2009 (UTC)

Yes. Go to the page for that template, and click on the 'What links here' in the toolbox on the lefthand side of the screen. You should see this page for this particular example. Plastikspork (talk) 20:59, 11 May 2009 (UTC)
Oh, sweet - thanks a million! Aatrek (talk) 23:01, 11 May 2009 (UTC)

Foreign exchange-rate converter

Does anybody know if one already exists to translate foreign currencies in articles into current USD equiv? I looked around but all I could find is one that just does it for Indian Rupees, and the template to describe FX markets (but not do any calculations). If there is not one for all major currencies, I'd like to take a stab at creating one... but I just don't want to spend a lot of time on it if there is already an established template.

I am thinking something like this in an article:

  • Text in edit mode: ... the bridge cost {{fx|JPY|300000000000}} to build ...
  • Text in article  : ... the bridge cost ¥ 300 billion (US$3.02 billion today) to build ...

The reason for the word "today" in the conversion results would be to make sure people knew this was not a static number, but may not be necessary if it seems obvious to everyone. I would use public data from the US Fed and update it weekly (hopefully automated at some point). Any/all feedback welcome.

Regards,    7   talk Δ |   04:25, 14 May 2009 (UTC)

No idea if there is one - perhaps you should also check at Wikipedia talk:Naming conventions (currency)? --Philosopher Let us reason together. 05:30, 14 May 2009 (UTC)
Will do - thanks, and the article WP:$ for the talk page you sent me to was also useful.    7   talk Δ |   05:38, 14 May 2009 (UTC)
  • I think you're on a hiding to nothing creating piece of calculating algorithm to convert 1965 GBP into today CZK. Not only do exchange rates change on a daily basis, there's also the historical parities to consider (ie what measure to use to convert). Accountants have been stuck for ages not being able to agree what measures to use for converting "yesterday money" into "today money". I think we are better off sticking to what the sources say about measuring historical cost of things in today's money (or just static cost using the exchange rate prevailing at the time the event happened. Ohconfucius (talk) 08:35, 14 May 2009 (UTC)
  • I hear what you are saying about historical exchange rate issues... but I was really hoping this would be a good excuse to jump into programming templates. Perhaps if it is more used for current/recent events and it is heavily disclaimered that it is based on direct current FX conversion, not counting inflation or TVM? Or still pointless? Also, one point to clarify, this was just going to be from foreign currency into US$ as is suggested currency to use in WP:$ - but your point is still just as relevant.    7   talk Δ |   08:55, 14 May 2009 (UTC)
  • I am biased towards static conversions. Quite often nowadays, a source will cite the local currency and a USD or EUR equivalent for any given transaction. If you had a magical calculating template, there is a risk that the calculated value may deviate from the source value- this could certainly be the case if the exchange rate used was dynamic (changing every day). I think we should forget trying to obtaing TVM/PPP type adjustments as being too problematic.

    Notwithstanding, technical issues which should be considered are burdens on the processing bandwith; the programming template must take into account when an event occurred, and then send that information to the enquiry database to choose the correct exchange rate, which will probably be a NY closing rate prevailing on that date (historical rate), any other rate would be meaningless. Of course, such data (even the very old) is now widely available, but we will be at the mercy of external databases; otherwise we would have to consider the impact on computing hardware WMF, so as not to be reliant. Ohconfucius (talk) 09:19, 14 May 2009 (UTC)

7, this is a great idea that, unlike many templates, isn't a solution in search of a problem. But before going further, let's be careful about the specs. First, is the idea to display any part in blue? If so, please think twice, because the result will be blue bits repeated throughout an article, which is tedious and not recommended by the style guides. Second, I think "today" is good as a nice, neat, short explanation—says it all. Third, weekly manual updating seems unduly frequent in these low-inflation days; I was expecting six-monthy or even yearly. Would there be a facility to limit the decimal places? US dollars today as the benchmark is fine by me. Please think of asking around a few WikiProjects for advice. MilHist and especially Hurricanes (damage done in previous years often converted) might be interested; I've reviewed many FA nominations that bring up the issue of equivalents.Tony (talk) 09:59, 14 May 2009 (UTC)
  • Fabulous concept. I hope you can pull it off. Like Tony stated, it should generate black text.

    It would also need to have good error-checking so if a date exceeded the available historical range for one or both currencies in the conversion, it would immediately generate a big red-text error alert.

    How would it work? It could convert currencies to a historical index of “1” relative to some convenient date, like 1 January 2000. Then it would just divide the “to” currency’s factor by that of the “from” factor. I should think that data lookup tables would be impractical or impossible. So to be accurate, I would think that that historical currency data from tables would have to be described as variable-degree polynomials, like Y = Nx3 + Nx2 + Nx + b. On second thought, scratch that; data lookup tables ought to be the way to go. Tables binned at yearly increments wouldn’t work well during periods of rapid hyperinflation, but I don’t see that is being a serious problem. All you would have to do is normalize each currency’s table to a “2000-equivalent” value and (again) divide the “to” currency’s 2000-equivalent factor by that of the “from” factor.

    Echoing a concern expressed by Ohconfucius, above: One potential stumbling block with this tool is it would take a knowledgeable shepherd to update the currency tables each time a new year’s data becomes available. Without such a person, such a tool would quickly grow to generate a lot of error codes. A work-around for such a shortcoming would be for the tool to not have an option to convert to a “today” value, but only to a specified date for which there is data; which is to say, it doesn’t generate an error code for the editor when they first try it. Such usage would look like The Germans spend ℳ5,100,000 on their V2 rocket (equivalent to $230,000,000 in 2008) (rather than “equivalent to $230,000,000 today”). It could be called “Historical currency converter” or “hcc”. Such syntax could look like {{hcc|germ-mark|5.1|1944|us-dollar|2008|2}}. The “2” at the end would stand for the significant digits to be used in the conversion.

    You could also go dollar-to-dollars or marks-to-marks, like this: {{hcc|us-dollar|2.1|1944|us-dollar|2009|2}} and the template would return the value “26”.

    For instance, one could code

    The U.S. spent $2.1 billion on the Manhattan Project (equivalent to {{hcc|us-dollar|2.1|1944|us-dollar|2009|2}}&nbsp;billion in 2009).

    …to generate this: The U.S. spent $2.1 billion on the Manhattan Project (equivalent to $26 billion in 2009). Super cool. I wish you well. Greg L (talk) 17:00, 14 May 2009 (UTC)

nothing like it in Category:Currency conversion templates. ---— Gadget850 (Ed) talk 17:17, 14 May 2009 (UTC)
  • “7” (initiator of this thread): If you want to pursue this, I would suggest that you solicit a volunteer template author to code the smarts (which should be relatively simple). Your contribution would be to do all the “donkey work” (enter the tables). One thing you two would have to do is make it so it is easy (well documented) for “mere-mortal editors” to create subpages with tables for new currencies. Greg L (talk) 17:29, 14 May 2009 (UTC)

    P.S. Unless, that is, you are a template author yourself. I assumed you weren’t since you didn’t know if such a currency converter was already available. But, I don’t know if expertise in writing templates necessarily means that one must necessarily have familiarity with what all is on Wikipedia. Greg L (talk) 17:33, 14 May 2009 (UTC)

(←)Thanks to all for the feedback. I'm not a template programmer but was a geek (clipper, delphi, vc++, vb, sliverstream, etc...) in a prior life, so I will definitely seek support from others to make it a properly-coded reality. The more I think about this the more I think it may make sense to have two templates:

  • one for straight FX (current or expected future cost): ... the bridge will cost {{fx|JPY|300000000000}} to build ...
  • one for historical conversions : {{hcc|germ-mark|5.1|1944|us-dollar|2008|2}}

I realize people may say that this should be a single template (since you can accomplish the FX by using todays date in the complicated HCC template) but I've got two reasons why I think they should be separate: first - I think overly complex (# of parms) templates discourage users trying to accomplish simple tasks, and second -it will be a lot easier for me to get my feet wet coding the simple FX one first and it can be used as a base for the second. Will give it a start over the weekend and post in my user space for review / discussion. Thanks again.    7   talk Δ |   00:57, 15 May 2009 (UTC)

Note, you can create a single front-end template to multiple backend templates. See, for example, {{convert}}, which is one of the more impressive undertakings. Plastikspork (talk) 16:30, 15 May 2009 (UTC)

Update:

(←)OK - here's a very rough draft. Clearly I'm no template pro, but most of it worked as expected. I haven't yet put the documentation in to a separate "doc" folder - but will do that shortly. Also, no real error checking in here yet (other than defaulted values where possible).

The good news is that I found this existing template:Inflation which can be combined with this simple FX template to make a Historical Conversion Calculator.

One thing I couldn't get to work was a sub-template to keep the rates separate from the code. For example, I have an excel macro that will easily pull the rates from the Fed's website and put them into this format: User:7/Template:fx/fxarray, and I was hoping that I could just put this {{User:7/Template:fx/fxarray}} into the middle of the main template code to have it transcluded (is that the right word to use), but it doesn't seem to work. Probably a simple fix. Any feedback or modifications are welcome. Thanks.    7   talk Δ |   13:34, 16 May 2009 (UTC)

I was hoping there would be other comments in the meantime because I didn't want to be the first and last word on this subject. However, I still have some serious misgivings about the underlying concept and I really don't think you should spend any more time on this just yet. Even if such a template is adopted, I believe it needs to used with a great deal of restraint. On Monday, I will write a fuller explanation as to the inherent problems which I hinted at above. Ohconfucius (talk) 13:59, 16 May 2009 (UTC)

  • Indeed. Ohconfucius and another editor recognized early on what the hazard was with User:7’s proposal. The issue of “when” is crucial in calculating conversions to other currencies. For instance, how can a Japanese Yen value quoted in 1988 be converted to USD using today’s conversion rate? I’ve unfortunately got a feeling that I am either galactically clueless or there is something amiss here. As far as I know, the only proper way to correctly do conversions is per the way I described with my “historical currency converter” method, above. It’s more than an issue of requiring the editor stick to the rigor of specifying a year for both the “from” and “to” currencies; this information is mandatory to pull off such a stunt without colossal-size errors often occurring. Greg L (talk) 03:15, 17 May 2009 (UTC)
  • Ohconfucius gave me sound advice in the beginning about problems with historical exchange rates, and I respect that advice. His was the first, but was not the last comment as other editors chimed in that this could be useful. Therefore, and this is a key point, I think that the straight {{template:fx}} template can/should only be used in current and or future looking articles, and the second template (which is yet to be created, but I like the suggested name of {{hcc}} for "historical currency conversion") will use a combination of this current FX data and the template:inflation to inflate historical prices. If I am still missing the point then please clarify what risks remain. Thanks.    7   talk Δ |   04:59, 17 May 2009 (UTC)
  • I'm nervous that the template could be taken as a fait accomplis, rendering an accurate equivalent for quite different cost/price structures. The loaf of bread, by our conversion, might have cost $3 in Afghanistan in 1970, but a kilo of lamb $600. Who knows? At the very least, I'd like to see a recommended scope (in time and to and from which currency jurisdictions), in which the template's calculations might be safely used. Tony (talk) 08:44, 17 May 2009 (UTC)
  • User:7 wrote of …current and or future looking articles… I’m not so sure about the “future” part. I think the only proper way to express an exchange rate is to always specify the date at which the conversion applied. For instance, one should write The Japanese government was planning on spending 70 billion yen in extra spending on new bullet train in 2009 (then US$730 million). Without a specific date, “current” and “future” soon becomes obsolete. Wikipedia is not supposed to have editorial content that rapidly becomes incorrect. I see nothing wrong with User:7 making what he is proposing. However, I think WP:MOSNUM will require some very explicit guidance on its proper use. Greg L (talk) 23:08, 17 May 2009 (UTC)
But that is better done with an explicit citation (for the conversion factor; multiplication is not original research) than by a template. Septentrionalis PMAnderson 02:13, 18 May 2009 (UTC)
  • I tend to agree with you PMA. I see serious pitfalls with a template like this. An editor might be quoting a value from an event that happened in 2003. Then, when they use a template in authoring an article today, it would be using a conversion for 2008 or 2009. I just don’t think a template like fx—as currently envisioned by User:7—will work as a practical matter when you think about how editors in the real world will really use the thing.

    To User:7: Note that PMAnderson and I rarely see eye-to-eye on anything. That we have the same opinion on this should mean a lot to you. if you are intent on pursuing a currency converter, something as I described with “hcc”, which enforces chronological rigor with both the “from” and “to” currencies, is the only way I can foresee that a template won’t frequently be accidentally misused. Greg L (talk) 02:45, 18 May 2009 (UTC)

Your opinions do mean a lot to me, and I appreciate your feedback. I agree with all the points you have made, and I had thought about the maintenance nightmare involved with going around and looking for any article using the fx template where the article was over X years old for potential conversion to the hcc template.
As I said originally the two reasons for starting with the simple straight fx template were 1) simplicity for the user of the template and 2) tackling a simple template as my first one. Well, now 2 is done and template programming isn't so bad (but I still can't figure out my sub-template question above) but I still think point 1) simplicity is important. I know there are templates out there I am tempted to avoid because they take too many parameters. So, how about this to accomplish both simplicity and correct historical conversions:
  • template:hcc will be created and will use template:inflation to PV the number and then use fx converting functions similar to what I have in the FX template now to change to US$. Any historical articles should use this template.
  • tempatate:fx will be a subst template which is replaced with hcc template and the current year so that the user has a simple entry and it never becomes obsolete. Current/near-future looking articles can use this template. Then I only update the fx template once a year with the current year number and the users still get their simple template.
  • Was also planning to incorporate a named ref tag at the end of the conversion referring readers to the template docs so they could understand the dates/times/rates used in the conversion.
And actually, as I write this, there is another pitfall that just came to mind. Technically I think the right way to represent this a historical foreign currency number would be to convert it to USD at a historical rate and then inflate it in the USD form. However I don't have easy access to historical FX data so the proposals I was writing above were to inflate in original currency per template:inflation and then to convert at current fx... That's not accurate at all. Any potential solutions, or is this a dead-end?.    7   talk Δ |   03:14, 18 May 2009 (UTC)
  • (←outdent). User:7: here is a US CPI table that goes back to 1913. Similar data is available—I believe—that goes back even further and averages the twelve months into a single value for a given year. Note also that Wikipedia’s own article on CPI has links to CPIs for other countries here. In my mind, the hard part in all of this is locating the best sources for each country’s data. From thereon, the process of creating tables and normalizing all the values to unity (1) for year 2000 is awfully straightforward.

    For a template to prove popular, it needs to be convenient and editors need to have confidence that their articles will look the same a year or two from now. Accordingly, one should convert as follows: The U.S. spent $2.1 billion on the Manhattan Project (equivalent to $26 billion in 2009). and should not write …equivalent to $26 billion today), because when 2010 roles around and User:7 has been hired by Microsoft and is too busy to horse around with updating a table on Wikipedia, the article would be incorrect in 2010.

    As for the concerns of Ohconfucius, below, he is a Wikifriend of mine so I don’t want to kick sand at his argument. I do see there is a “Manufacturer cost index in addition to a CPI. However, other countries have provide CPI for their currencies. For instance, Sweden has this CPI from 1290 to 2006. CPI seems like a sufficiently probative metric and the data is available for many currencies. I think this is doable and would be of benefit to Wikipedia if properly implemented. It is, however, no small undertaking and one certainly must be dedicated and meticulous to pull it off. Greg L (talk) 04:16, 18 May 2009 (UTC)

  • "As for the concerns of Ohconfucius, below, he is a Wikifriend of mine so I don’t want to kick sand at his argument." I don't mind, Greg. This is all in the spirit of open discussion as there is no interest to this debate being one sided. The key is that our shared views here help to advance the cause. It may end up with something which works and is accepted once the concerns have been addressed. Ohconfucius (talk) 06:13, 18 May 2009 (UTC)

Counter-argument as promised

Prices move in relation to each other according to supply and demand - this is the classic definition of how the market mechanism works; the price of different things also vary at different rates through time. This is not to be conflated with link between the general trend of prices (as measured by the Consumer price index) and the money supply.

As prices may move differently, it is often appropriate to use different 'inflators' depending on what the subject is. You can see from a quick visit to this website that they give six methods/indices which could be used to calculate, for example, one of Handel's annual pensions (₤200 per annum in 1713) of USD $303 - equates to (at least) $8,342.30 in 2008 using the CPI-based calculation method, but turns out to be (at least) $157,100.91 in today's money using a wage-inflator. Depending on what benchmark is used for the adjustment because rates of inflation (or evolution of cost of living or purchasing power) may differ between countries or between categories of individuals, the 'adjusted value' may differ considerably. The Handel example illustrates my point very well, as the difference here is a factor of 18. It can be seen that we get a very wide ranging result for Handel's pension.

Paradoxically, the only index generally used to de/inflate is the retail prices index, which is based on a basket of commodities which reflect the cost of living. Even so, governments have been known to understate this for political reasons. Except in the most broad and general cases, the CPI will never result in the correct figure. There are official data about the cost of building houses, upon which house insurance calculations are generally based; if a reader wants to know the equivalent cost today of building a Dreadnought, or how much in today's money the QE2 cost, we would use a specific index for shipbuilding, instead of using the CPI.

Journalists and economists often compare then-to-now costs - we see these in newspapers often enough. Usually, such figures are pretty wild estimates which may vary depending on the hypotheses used. Physical storm damage is a real cost of repair/reinstatement can be measured with some accuracy; others are opportunity costs. It is here where we get differences of several orders of magnitude. I have no problem with comparative valuations as such so long as figures are sourced/attributed.

There are people armed with copious data and powerful algorithms who calculate such things for a living, so it's a can of worms for us mere mortals here on WP to decide, except on a very general level, and I don't trust the average WP editor to be able to be able to handle when such a template would be used. It is potentially all too easy to fall foul of WP:NPOV or WP:SYN. That's why I prefer attributed static conversions to such a dynamic solution. Ohconfucius (talk) 03:36, 18 May 2009 (UTC)

Template/Switch question

Technical support question - Separate from the merits of the FX template in the discussion above, can anyone help me understand why this concept won't work for templates within templates. (would still like to understand why it doesn't work even if we decide the template itself is not that useful).

Question: For ease of maintaining lookup tables I wanted to have one template which contains the code and another subtemplate which contains the data that I am working with. It works fine when the data and the code are together, but I can't get it to work when the code just opens another template with double curly brackets for the data.

Here's an example:

  • Sample output page with the broken template called for each currency : User:7/Template:fxtest-doesntwork (it is returning Not-a-Number because the switch formula is returning "undefined" which seems to be the only thing the switch formula can see when the other data is in a subtemplate.)

Not sure if this is a template question or a switch question, but I suspect a template guru will figure it out in about 4 seconds.

The reason I wanted to do it this way is that I have an excel macro that will easily down and format all the data that I need so that I can store/update it separately here: User:7/Template:fx/fxarray, and I was hoping that I could just put this {{User:7/Template:fx/fxarray}} into the middle of the main template code to have it transcluded (is that the right word to use?), but it doesn't seem to work. Any thoughts on how to fix? Thanks.    7   talk Δ |   03:31, 18 May 2009 (UTC)

Any thoughts?    7   talk Δ |   22:41, 27 May 2009 (UTC)

Question

Do you have the following possibility: including an article on a page, but with only a certain number of characters? --82.171.95.220 (talk) 15:52, 27 May 2009 (UTC)

I'm not sure what you are asking. Can you provide an example? Plastikspork (talk) 17:14, 27 May 2009 (UTC)
I think he may be talking about transcluding part of an article. We don't do this in mainspace for a number of reasons, but it is used for some portals. For example, List of counties of Lithuania uses content in <onlyinclude>...</onlyinclude> tags to show a portion on Portal:Featured content. Note that the portal pulls the featured items from a random list, so List of counties of Lithuania may not be the one that actually shows. ---— Gadget850 (Ed) talk 18:15, 27 May 2009 (UTC)

Is it possible to limit the number of variables that get processed or displayed?

The Video games project uses a template ({{VG reviews}}) to display reviews scores given by publications. Though it is not a requirement in articles, it is used in a large number of them. A common problem is that editors tend to include every review score they can get their hands on, basically bloating the table to impractical lengths.

My question is if there is a way to limit the number of scores that get displayed? For instance, if an editor inputs 11 or more scores, only the first 10 will show up. I realize that a set amount of numbered parameters could be used, but the current set up works rather well. Mainly because the current parameters properly format publication names and links.

Is such a thing possible? (Guyinblack25 talk 20:56, 1 June 2009 (UTC))

It looks like the template has rev1/rev1Score through rev8/rev8Score, limiting the scores to eight. This does not prevent someone from stacking scores in one set of parameters using breaks. If you want to reduce that number, discuss it on the template talk. ---— Gadget850 (Ed) talk 10:38, 15 June 2009 (UTC)
Actually those are meant to supplement the commonly used review sites like 1UP.com, IGN, and Nintendo Power. "Rev1"–rev8 would be for reviews from publications that are not commonly used, like newspapers and other media that is not gaming centered on video games.
There's about 50 possible publications that can be added to the table, which when all are used is too much. I'm looking to keep all the possible publications, but limit the number that will be displayed. If it's not possible that's ok, I'm just trying to see what the options are. (Guyinblack25 talk 14:35, 15 June 2009 (UTC))

Please review my changes

After these changes, I'd like to ask for review. This page should both give information to those struggling with the very concept of transclusion, and to those seeking the technical details. I'd place myself among those who grasp the basic concept well, but still grapple with the ancient mysteries...

So what I've done is try to explain how the parser lists template transclusions for any given Preview (i.e. it does NOT show which actual templates were called from the page/section you actually edited, instead it enumerates EVERY template invocation required to render the preview); how it acts when viewing a page from history (where I'm pretty sure it doesn't seek the historic version of the template and all sub-transclusions thereof) (and this was already alluded to in "Revision history of pages containing templates", way down there where most people would have long stopped reading); and a little discussion of what exactly the performance implications are, and the NewPP report.

These have all arisen in the context of the very complex {{convert}} template, which exemplifies almost all of the changes I've made.

My request here is for those more knowledgable to evaluate the factual accuracy of my changes; eliminate overlaps with "advanced" template help whilst still preserving links; and possibly creation of a separate section dealing with performance implications and the new pre-processor report in the HTML. Thanks! Franamax (talk) 23:48, 18 July 2009 (UTC)

Parameters to show a different text

I'm trying to make a template with several different outputs. For example, if you use {{Template | Date}} it will transclude 24 July, 2004, but if you use {{Template | Time}} it will show 13:04 specified by the template.

I imagine the template code itself would be something like:

| Date = 24 July, 2004

| Time = 13:04

Is there a way to do this? Smurfy 15:07, 19 July 2009 (UTC)


You can do something like this:

{{#if:{{{date|}}}|{{{date}}}|{{#if:{{{time|}}}|{{{time}}}}}}}

If the date parameter is non-blank, then show the date; else show the time if it is non-blank. ---— Gadget850 (Ed) talk 17:56, 19 July 2009 (UTC)

Adding text after calculation

How can I add a text, say unit miles, after the result of

{{#expr: ( 27 * 46 / pi ) round 2 }}

from with in the template? In other words, I want the template to return the word miles too as a part of its result in an article.  — [Unsigned comment added by 76.69.90.229 (talkcontribs).]

You can just write the word miles after the expression
{{#expr: ( 27 * 46 / pi ) round 2 }} miles
Does that work for you? Plastikspork (talk) 05:12, 23 July 2009 (UTC)
Yes it worked. Thanks! —Preceding unsigned comment added by 76.69.90.229 (talk) 23:03, 23 July 2009 (UTC)

Bar chart template

I would like to create a bar chart similar to this one on the Dutch wiki: http://nl.wikipedia.org/w/index.php?title=FC_Twente&action=edit&section=23

Can anyone inform me how to proceed with this? Does an equivalent template exist in English (copy & pasting the Dutch one doesn't work)?. Thx. --Wolbo (talk) 15:35, 29 July 2009 (UTC)

I translated it at User:Gadget850/Sandbox7. Had to replace "sjablooninfo" with the English version at {tl|Informative template}}, then the example uses "BalkVerticaal2" which is the actual template. Balk Verticaal trqanlates as Vertical Bar, but there is a different template there. Perhaps "Bar chart vertical" would be good. ---— Gadget850 (Ed) talk 17:49, 29 July 2009 (UTC)

Template trouble

A group/list template with more than 20 groups (Template:National personifications) won't show the 21st group. If this is a general constraint on group/list templates, what other kind of template could be used instead? RandomCritic (talk) 10:27, 17 August 2009 (UTC)

Yes, {{navbox}} has a limit of 20 groups. You could use something other than navbox, or split the box. Plastikspork ―Œ(talk) 16:39, 17 August 2009 (UTC)
That navbox is really a long list; it could use some rework. ---— Gadget850 (Ed) talk 17:08, 17 August 2009 (UTC)
You could, perhaps, introduce subgroups, or make it two column? Or, perhaps just a bullet separated flat list. Plastikspork ―Œ(talk) 17:42, 17 August 2009 (UTC)
Perhaps {{Navbox with columns}} would be a better choice. ---— Gadget850 (Ed) talk 13:55, 20 August 2009 (UTC)

 Done. All fixed.
 —  .`^) Paine Ellsworthdiss`cuss (^`.  09:08, 19 September 2009 (UTC)

Problem with if scripts

I'm a user on the Danish version of Uncyclopedia ([4]). I've been trying to get this template to work in a few days, but somehow it just won't do as I want. It's meant to create a table with two rows and a picture to the right. In the upper row, there is going to be security marks for a product, while the lower row is going to have up to four columns with product descriptions.

The problem lies in the upper row, as the lower row already works. Se the result here: [5]

Here's the script (most of it is in English; only security mark descriptions are in Danish). You should look at the script of this page, as Wiki puts everything into one line here:

{| border="1" class="metadata" style="width:100%; background-color:rgb(255,102,0)" | {{ #ifeq: {{{picton|0}}} | 0 | colspan="2" | }} style="align:center;" | {{ #if: {{{1mark|}}} | {| | [[billede:{{ #switch: {{{1mark|}}} | ætsende | miljøfarlig | lokalirriterende | giftig | eksplosiv | brandnærende | brandfarlig = {{{1mark|}}}.gif | #default = {{{1mark|}}} }}]] |- ! <big>{{{1head|}}}</big> |- | {{{1text|}}} |} | }} {{ #if: {{{2mark}}} | {| | [[billede:{{ #switch: {{{2mark|}}} | ætsende | miljøfarlig | lokalirriterende | giftig | eksplosiv | brandnærende | brandfarlig = {{{2mark|}}}.gif | #default = {{{2mark|}}} }}]] |- ! <big>{{{2head|}}}</big> |- | {{{2text|}}} |} | }} {{ #if: {{{3mark}}} | {| | [[billede:{{ #switch: {{{3mark|}}} | ætsende | miljøfarlig | lokalirriterende | giftig | eksplosiv | brandnærende | brandfarlig = {{{3mark|}}}.gif | #default = {{{3mark|}}} }}]] |- ! <big>{{{3head|}}}</big> |- | {{{3text|}}} |} | }} {{ #if: {{{4mark}}} | {| | [[billede:{{ #switch: {{{4mark|}}} | ætsende | miljøfarlig | lokalirriterende | giftig | eksplosiv | brandnærende | brandfarlig = {{{4mark|}}}.gif | #default = {{{4mark|}}} }}]] |- ! <big>{{{4head|}}}</big> |- | {{{4text|}}} |} | }} {{ #if: {{{5mark}}} | {| | [[billede:{{ #switch: {{{5mark|}}} | ætsende | miljøfarlig | lokalirriterende | giftig | eksplosiv | brandnærende | brandfarlig = {{{5mark|}}}.gif | #default = {{{5mark|}}} }}]] |- ! <big>{{{5head|}}}</big> |- | {{{5text|}}} |} | }} {{ #if: {{{6mark}}} | {| | [[billede:{{ #switch: {{{6mark|}}} | ætsende | miljøfarlig | lokalirriterende | giftig | eksplosiv | brandnærende | brandfarlig = {{{6mark|}}}.gif | #default = {{{6mark|}}} }}]] |- ! <big>{{{6head|}}}</big> |- | {{{6text|}}} |} | }} {{ #if: {{{7mark}}} | {| | [[billede:{{ #switch: {{{7mark|}}} | ætsende | miljøfarlig | lokalirriterende | giftig | eksplosiv | brandnærende | brandfarlig = {{{7mark|}}}.gif | #default = {{{7mark|}}} }}]] |- ! <big>{{{7head|}}}</big> |- | {{{7text|}}} |} | }} {{ #if: {{{8mark}}} | {| | [[billede:{{ #switch: {{{8mark|}}} | ætsende | miljøfarlig | lokalirriterende | giftig | eksplosiv | brandnærende | brandfarlig = {{{8mark|}}}.gif | #default = {{{8mark|}}} }}]] |- ! <big>{{{8head|}}}</big> |- | {{{8text|}}} |}|}} | {{ #ifeq: {{{picton|0}}} | 1 | rowspan="2" width="{{{pictwidth|}}}" }} | {{ #ifeq: {{{picton|0}}} | 1 | [[billede:{{{pictaddr|}}}|{{{pictwidth|}}}]] }} |- | {{ #ifeq: {{{picton|0}}} | 0 | colspan="2" }} | {{ #ifexpr: {{{cols|1}}} >= 1 |<div style="width: {{ #expr: 100 /{{{cols|1}}} }}%; float: left;">{{{1col|}}}</div>}} {{ #ifexpr: {{{cols|1}}} >= 2 |<div style="width: {{ #expr: 100 /{{{cols|1}}} }}%; float: left;">{{{2col|}}}</div>}} {{ #ifexpr: {{{cols|1}}} >= 3 |<div style="width: {{ #expr: 100 /{{{cols|1}}} }}%; float: left;">{{{3col|}}}</div>}} {{ #ifexpr: {{{cols|1}}} >= 4 |<div style="width: {{ #expr: 100 /{{{cols|1}}} }}%; float: left;">{{{4col|}}}</div>}} |} — Preceding unsigned comment added by 90.185.27.224 (talk) 18:00, 16 November 2008

Template naming conventions

I've suggested standardizing template naming, at Wikipedia talk:Template namespace#Template naming conventions. If you're frustrated with typing template names and constantly guessing at the right capitalization and spacing, please chime in. Michael Z. 2009-01-10 17:46 z