This is an archive of past discussions about Help:Template. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page.
This is odd. So I was on ASVEL Basket and noticed the roster was out of date. I was going to edit it, but then I clicked the little e it went to a page that said there isn't a template named that. The template is here Template:ASVEL_Lyon-Villeurbanne but when I edit it, it says it's not there. So where is it? --AW (talk) 20:31, 24 March 2011 (UTC)
You are correct in that it was linking via Template:ASVEL Lyon-Villeurbanne roster, but when creating the redirect, you forgot the crucial word "Template:", as in
<includeonly>
Line to be included on all transclusions.
<includeonly>
Line to be included on all transclusions except the first.
</includeonly>
</includeonly>
but it didn't work. It seems to ignore the second <includeonly> and display the second </includeonly> as text. Is that what you were asking? Themeparkgc Talk 10:00, 7 February 2011 (UTC)
Perhaps you can do it somehow, but not like that (the parser will assume that the first closing tag goes with the first opening one - it won't handle nesting of the same tag). Try breaking up the syntax by writing <noinclude></noinclude> somewhere in the middle of the includeonly tag(s) - that sort of thing quite often works.--Kotniski (talk) 15:41, 7 February 2011 (UTC)
Why does this not work? <includeonly><</includeonly>includeonly>abcdefg<includeonly><</includeonly>/includeonly> The includeonly tags end up appearing as normal text rather than working. McLerristarr | Mclay117:02, 24 February 2011 (UTC)
The same thing happens when I do this: <include<noinclude></noinclude>only>hijklmnop</include<noinclude></noinclude>only> Breaking the includeonly tag stops it from working and makes it appear as normal text. There doesn't seem to be any way of making a template transclude an includeonly tag on a page. McLerristarr | Mclay117:08, 24 February 2011 (UTC)
Yes, on reflection, it probably isn't possible. The parser probably does things in a different order than it would need to for this to work. (I.e. if your page says {{A}} and Template:A contains {{B}}, then it won't transclude B onto (a working version of) A and then transclude that onto your page; it will just transclude A (i.e. the text {{B}}) onto your page, and then process that text further by transcluding B onto your page. B only really undergoes one transclusion operation. I suppose it would work if you subst:'ed B on Template:A, but that might not suit your application.) --Kotniski (talk) 17:16, 24 February 2011 (UTC)
Caching issue. I opened the template, made no edits, then saved it, and now it appears in the category. I find this is necessary if you add the category to the doc page and don't want to wait for the server to recache the page. Thanks! Plastikspork―Œ(talk)20:44, 2 April 2011 (UTC)
parameters in templates passed into templates tested and failing
I have a problem with testing parameters being used in one template which work as I expect when the template is called directly. But if the same template is called from another one the testing of the parameters does not work the same way. I know what is failing but I can not find anything in the help pages on how to fix it.
{{TB|pam1=FU|pam2=BAR}} The test inside the template works as expected but
{{TA|pam1=FU|pam2=BAR
{{TB|pam1=FU|pam2=BAR}}
}} the test within TB fails. Is this the best place to discuss this problem or is the a better one? -- PBS (talk) 23:42, 26 March 2011 (UTC)
Na I used those initial as short for "TemplateA" "TemplateB". The best thing I can do is make two simple templates which display this problem. At the moment the actual templates they are quite complicated so its wood for trees. I set up a simple example some time in the next day or so, and then post it here. First I wanted to check that this was the best place to discuss it. --PBS (talk) 00:11, 28 March 2011 (UTC)
OK in my own name space I have set up two templates. here is the first template:
Print in Test:<!--
-->{{#ifeq:{{{wikisource|{{{wstitle|}}} }}}|<!--eq to empty
-->|<!--then-->Print Hello 1
|<!--else-->Print Hello 2
}}
The second template is:
{{test
|wikisource= {{{wikisource|}}}
|title= {{{title|}}}
|wstitle= {{{wstitle|}}}
}}
Here are three examples calling what I have described above as "test" directly:
{{User:PBS/test|title=FU}}
{{User:PBS/test|wstitle=FUws}}
{{User:PBS/test|wikisource=FUsource}}
Here are are the same parameters passed into a second template (test2) that calls the "test" passing in three parameters:
{{User:PBS/test2|title=BAR}}
{{User:PBS/test2|wstitle=BARws}}
{{User:PBS/test2|wikisource=BARsource}}
The problem lies in the handling of FUws "Test:Print Hello 2" and BARws "Test:Print Hello 1". Until I ran across this problem I would have expected the two tests would be the same. If I alter the internal test code from {{{wikisource|{{{wstitle|}}} }}} to {{{wstitle|{{{wikisource|}}} }}} then as I would expect given the first failure is wikisource that then displays two different results.
Got it. The thing is that whilst you have filled in |wstitle= in both cases, the parameter |wikisource= is treated differently depending upon whether it is present or absent. Note that "present" does not mean "has been given a value". The construct {{{wikisource|{{{wstitle|}}} means "if wikisource is present (regardless of whether it has a value or not), use {{{wikisource}}}; if wikisource is entirely absent, use {{{wstitle}}}".
If you intend a blank parameter to be treated as if it were completely absent, you need to amend the second line of user:PBS/test, thus:
-->{{#ifeq:{{#if: {{{wikisource|}}}|{{{wikisource}}}|{{{wstitle|}}} }}|<!--eq to empty
Or to explain it slightly differently, the second template is always passing some value of wikisource to the {{user:PBS/test}} template, even if it's only the empty string, so the test template will (then) never be interested in the value of wstitle.--Kotniski (talk) 17:43, 28 March 2011 (UTC)
Thanks to both of you. OK although I understand your explanations, but I am clearly missing one level of intellectual understanding as I had assumed that functions called from within functions would handle parameters in the same way as they would when called from a page and that was my understanding from reading #Pass-Through Parameters (Redux) above ie there was no concept of a global variable. Is there a help page that discusses this concept? If not I think it would be helpful if a section was added somewhere.
An immediate problem that I have is that for the test I used a simple two parameter test, but what I want to test is five parameters long:
It's not a case of different behaviour of templates when used directly in articles vs. when used in other templates, but different behaviour depending upon whether unneeded parameters are blank or omitted. Consider the following:
{{User:Redrose64/test|wstitle=FUws}}
{{User:Redrose64/test|wstitle=FUws|wikisource=}}
The only difference between the two is that the second one specifies |wikisource= but leaves it blank. The resultant output is:
There is indeed no concept of a global variable; neither are there local variables. All we have are system variables, which may be read but not written to: these include such things as {{PAGENAME}}.
In the middle of the "Full syntax..." section it says The value of a parameter can be the empty string (pipe or equals sign followed immediately by the next pipe or the closing braces). This is different from leaving the parameter undefined (although templates are often coded so as to behave the same in both cases). Does this need to be made more prominent and/or clearer and/or repeated in other parameter-related sections?--Kotniski (talk) 09:08, 29 March 2011 (UTC)
OK got it now! By modifying the second template (test2) to :
{{test
|title= {{{title|}}}
|wstitle= {{{wstitle|{{{wikisource|}}} }}}
}}
The problem goes away! because wikisource is no longer passed into the first template (test) so it is no longer set to blank. I see now that my focus was on the wrong template.-- PBS (talk) 00:21, 29 March 2011 (UTC)
We have about a hundred IPA templates, for different languages, which accept a sound file as a parameter. They're identical in this part, so I thought I'd try spinning it off as a nested template. However, I cannot get the file name to pass.
{{IPA-fr}} is an example. The 'if {{{3}}}' part is for the audio file. I've tried a few things on a test page {{IPA-fr2}}, trying to pass {{{3}}} to {{IPA audio link}}. What am I missing?
The basic usage examples use {{sup2}} as a demonstration. As {{sup2}} has been marked for deletion, this makes the section difficult to follow (and a little too meta) for a new user like me. Talteneder (talk) 00:23, 13 August 2011 (UTC)
Yes, I was first going to use {{schwa}} which is very much like {{theta}}, but then I realized that it's actually too complicated to use as a "very simple template" example because it nests {{IPA}} inside, and once you start explaining that, which you sort of have to, it's not so simple anymore.--Fuhghettaboutit (talk) 10:51, 14 August 2011 (UTC)
Wikipedia's template scripting problem
Template scripts are difficult to read and the behavior is hard to predict. Code written in it are often brittle. Yet there is no playground made available to users for testing templates before deployment. This results in people keeping around poorly programmed templates out of fear of the ramifications of editing. IMHO this is an aspect that is fundamentally broken right now. --Bxj (talk) 03:10, 24 August 2011 (UTC)
You can test any template you'd like by creating it in a subpage of your userspace. You can also make a template sandbox in the template space by making a sandbox of the template, usually with the name of the template you will be creating followed by "/sandbox", which for many high use templates, already exist, e.g., {{db-meta/sandbox}}; {{Infobox person/sandbox}}. Note also {{Template sandbox}}. So in sum, I don't know what you mean.--Fuhghettaboutit (talk) 03:22, 24 August 2011 (UTC)
(edit conflict) If you are familiar with the markup, then the behavior is predictable. You can create templates in a sandbox or in your user space for development and testing. I develoepd a template in my userspace today before I added to template space. You can use {{User:Bxj/template}} just like any other template. Simply copy a template into your userspace and play with it. If there is a template that has issues, then fixes should be discussed. I have helped to fix, enhance and streamline any number of templates, and have proposed several for deletion for various reasons.
I proposed changes to a template here: Template talk:Country data Switzerland#Proposed source adjustment to edit default size, but after the template change was applied, I noticed that the desired changes didn't occur, thus the desire for a sandboxed testing environment where I can make sure what I am proposing works. I will take up on the advice and create user namespaced categories and templates and see how well I can test MediaWiki this way.
I also had problems with Template talk:Infobox comics creator#Bug in rendering when yob param is specified. The pre-existing solution was a workaround by requiring the sortkey field, rather than a programming solution that would fix the issue when the sortkey was not specified. I would have liked to have known the programming solution to this problem. (There is a larger discussion about potentially removing the sortkey param entirely from the template, however.) --Bxj (talk) 00:26, 29 August 2011 (UTC)
Your example suggests you are trying to create an Infobox from scratch. If you build on the {{Infobox}} template then unused entries disappear completely without you having to do any extra work; see {{Infobox person}} or an example of a template that builds on {{Infobox}}. Alternatively you can build the "if" logic directly into your template; look at {{Infobox planet}} for the code to do this. -- John of Reading (talk) 08:10, 30 August 2011 (UTC)
Thank you. I have created many templates already so I dont think I will start with infobox again. Also, I could not figure out the if function but I was able to use this code.
Auto-including pages that use templates into categories
Resolved
When templates automatically include a page that uses them into some category, I have found that this can often cause trouble. Sometimes people use templates in User spaces pages, which then causes these userspace pages to be included in the encyclopedia categories. Sometimes people also explicitly use code to include a page into a category. This can be very confusing when you are trying to remove a page from a category because you delete the category yet the page remains in the category. It can take a while to figure out. In general, I think the practice of auto-including pages into categories is a poor one. Mainly because it destroys the conceptual simplicity of a template as the template can now have "non-obvious" unintended effects. After a period for comments, I will add a sentence about this to this help article. Jason Quinn (talk) 17:14, 13 September 2011 (UTC)
Do you mean the problem of whether the 20th century is the popular idea of 2000 to 2099 or the official one of 2001 to 2100? Yes any problem like that can be fixed fairly easily though I'm not the one to do it. You'd probably need to just notify some project page about this too as I can imagine you'll get arguments and need somewhere to point to saying what the resolution was! Dmcq (talk) 14:20, 21 January 2012 (UTC)
I think I'd need to point out decade as well where it says 'Since the common calendar starts from the year 1, its first full decade contained the years from 1 to 10, the second decade from 11 to 20, and so on. So while the "2000s" comprises the years 2000 to 2009, the "201st decade" spans 2001 to 2010.' So you'd have to phrase the decades bit properly as well if you want 2001—2010 to be a decade. Dmcq (talk) 14:28, 21 January 2012 (UTC)
Which case to use for the first letter of a template name
Hi. Now, I know that when using any template, e.g. Template:Reflist, one can type either {{Reflist}} or {{reflist}}. The main Template page states that either works.
But I'm a stickler for standardisation, so I'd like guidance as to which case people consider better.
Has this been discussed before, does anybody know? Many may say it's too trivial to discuss. Fine, but do others have a view?
It has been discussed, but the argument was so heated that no consensus was reached. Put simply:
It really doesn't matter.
Template names are just like other page names: they are case-insensitive on first letter, case-sensitive on all the others. When adding templates, use whichever form you feel comfortable with; you can mix them up if you like, but please don't alter existing usage, it can annoy other users. --Redrose64 (talk) 17:25, 25 January 2012 (UTC)
I'd like to auto-categorize language infoboxes for maintenance when the data is more than 30 years old. (In that time the figure could easily double, or the language could go extinct.) I'm adding a date parameter to encourage better coverage, but the problem is that it will very often be more than just a numerical year. It could be a span, say 1987–1993 (if data from various countries are not all from the same year), or could have a comment like 'decreasing' or 'census', or include a ref or fn. If I can truncate the string to the first 4 digits, then I'll have a numeric input that I can use. However, the only way I know how to truncate is with #sub, and I don't think I can feed a parameter into that: it treats it as a raw string. So,
So a redundant date field? I worry about maintenance. I doubt it would be kept up since it wouldn't be visible. — kwami (talk) 03:52, 13 November 2011 (UTC)
I'm working on the wikibooks site and I have dozens of examples where I want to pass a table as a parameter to a template. I'm fully aware that you need to replaced | with {{!}}, but editing table code using that is very hard to maintain, and copying and pasting backwards and forwards from notepad is starting to get on my nerves. Is there any way that we could do the following:
{{CPTAnswer|
{{safetable:
{| class="wikitable"
|-
! Header text !! Header text
|-
| Example || Example
|}
}}
}}
where {{safetable: will do the | to {{!}} conversion on the fly. How would one go about doing this? Is there any way to implement it without writing to the mediawiki core? Pluke (talk) 23:49, 20 December 2011 (UTC)
The main reason for the vertical bar template is due to evaluation of the bar as a another "parameter" of the template. What i have done though in my playing's, was to create templates for tables (and its possible children) and from that created as abstract a structure as i could. Spent alot of time on it but seemed to work on the deployments i did. Read up on the family of templates Template:Cot associated. I am actually fixing to implement a design similar to the Cot and Cob for alot of the wiki syntax objects. Starting with the table syntax and then moving up from there. — Preceding unsigned comment added by Goldbishop (talk • contribs) 03:51, 5 February 2012 (UTC)
Am out of depth with setting up a reader help service
At present the Main Page has a link to Wikipedia:Help desk for anyone to ask questions. This is used for those who edit WP and those who only want to read WP. I am in the process of setting up a mock-up page for messages that come from readers only. I have set up an initial page at Help:Help desk (a funny name but it is the best choice). I want to have the system used by {{Leave feedback}} to simplify the process of adding new messages. When a reader clicks on the "If you can't find an answer, ask a new question." link on Help:Help desk I want a preloded message in a new section of Help:Help desk with a header that has the User and a date stamp. Note that I have set up Template:Help desk preload and Template:Help desk editintro. -- Alan Liefting (talk - contribs) 22:20, 11 March 2012 (UTC)
Are you planning to generate the section headers automatically? This is possible; you could adapt the coding used by the "Leave feedback" links on the help pages. But the current mechanism is clunky, since the edit summary is saved before the name and timestamp are subst'd - see for example the history of this example feedback page. This would make life difficult for helpers since a quick look at the recent history would give no clues about the subject of the question.
Yes, that is a drawback but I am trying to set it up to be as simple as possible for someone who is daunted by wikicode and edit boxes. A lack of subject in the edit summary may be a small price to pay. -- Alan Liefting (talk - contribs) 09:30, 12 March 2012 (UTC)
I think this sets the section heading. When I tried it, the edit summary did include the user name and date/time after all. I don't know enough about the {{leave feedback}} templates to explain the difference. -- John of Reading (talk) 10:01, 12 March 2012 (UTC)
How do I include something on only one page but not on pages that pull from that page. I have a page that I don't want to include in C:Wisdom -1 items and filtered it out with the template that automatically puts it in the C:Wisdom -1 items with this ugly mess of code:
The Stat template is using |#default in the namespace switch as shown in the code you posted above. If you remove it, only the namespaces specified (category, file, forum, help, template and user) would be categorized. — Bility (talk) 20:29, 16 March 2012 (UTC)
The namespaces specified (category, file, forum, help, template and user) are the ones I am trying to exclude, which works. I want to also include anything that calls those pages. -- Technical 13 (talk) 20:38, 16 March 2012 (UTC)
I would add an optional parameter to Template:Stat to turn off categorization and use it on Category:A Small Problem loot. Right now the category is being turned off on that category page with a title check for "loot" and the namespace switch, but if you do it explicitly with the template call, it will also be suppressed on any pages transcluding Category:A Small Problem loot. The pages that actually should be categorized, like Brawn's Spirits, are using the standard Template:Stat, so wouldn't be affected. By the way, from the few pages I've seen it looks like the whole wiki is way too dependent on using templates instead of just plain wikitext. — Bility (talk) 23:51, 16 March 2012 (UTC)
Hide section header if it's not needed
Hi, I have been having an issue with my infobox template. When I make a header for a section in my infobox template (e.g.
|-
! colspan="2" style="background-color:#C0C0C0; color:black;" |Measurements
|-
) it works fine, and appears. But if I use the infobox for a character who doesn't have info for a section (e.g. no measurements were provided), the section header appears anyways, even though nothing is under it. I found a page on another wiki that has a template that does the same sort of thing mine does. My template would look kind of like this one, if I use it for a character who doesn't have the info supplied. you see, the appearence section should appear, since there is info there. But, there are no stats, but the section header still appears. Is there a way to hide it? So that the template doesn't show it if there's nothing under it used. 98.217.230.157 (talk) 21:21, 31 March 2012 (UTC)
I had the same intention at one point. The only way I could find to do it on my wiki was to make the table in the template using HTML code instead of wiki shortcuts.. So, instead of:
At present it does not have assistant coach entries (Note that {{Infobox NCAA team season}} does has assistant coach entries.)
The first edit I want to make is straightforward:
Add fields for AsstCoach1, AsstCoach2, AsstCoach3, Director of Operations
I assume I have to edit the info box and use the if statement, because not everyone will list assistant coaches, and not everyone has a director of basketball operations.
However, I would like to add a field for Associate Head Coach, for those teams with that position. It would be odd to have "coach" and "Associate Head Coach"; I would like to change "coach" to "Head Coach".
I'm concerned that if I make that change, it will break existing uses of the template.
I see that coach is already Head Coach. Making such a change, simply change the output, not the input OR change the output and input, but change the input to accept both variations of the variable (eg. {{{HeadCoach|{{{coach}}}}}}) . I hope this answers your question. -- Technical 13 (talk) 15:28, 14 April 2012 (UTC)
The navbox doesn't permit word wrapping within a list entry, so when an entry is excessively long (as is the case for several here), it forces the navbox to be wider than the visible width.
Yes, remove the superfluous subtitles so long as the main title remains unambiguous; and I see that some entries have the publisher information as well. If this can also be removed without creating ambiguity, do that too. --Redrose64 (talk) 15:46, 19 April 2012 (UTC)
Categorization
Where should eponymous templates be categorized (using "noinclude" tags in the template footer, of course) in/under the eponymous category?
Consider the nested categories C. S. Lewis; Narnia; The Space Trilogy, where the former (author) contains the other two (fiction series). All three have dedicated templates. Narnia has multiple templates which are in their own subcat of c|Narnia. I don't find {{C. S. Lewis}} anywhere in his category and I find {{CSL Space Trilogy}} sorted as a 'T' for template article. --P64 (talk) 19:10, 15 May 2012 (UTC)
A fortnight later, I think that [a] every eponymous category should directly contain the eponymous template, if any, where the template should sort to the top(* or +).
[b] wherever it is categorized, a template (category) should sort to the top or by a substantial word in the title, never by 'T' for template. So it needs a sort key, other than FULLNAME. -P64 (talk) 16:53, 29 May 2012 (UTC)
This isn't a template parameter in the sense of this documentation, but I would ordinarily call it the name parameter.
The general templates --what term is appropriate?-- {{Navbox with columns}} and {{Navbox}} both commonly begin (or so i have seen in edit mode) |name=.
For what does it matter that the given value match the pagename?
Sometimes they differ and I suppose that I have just discovered one problem. The specific templates --term?-- {{Narnia}} and {{Narnia characters}} are a Navbox with columns and a Navbox that both set name=Narnia. In both cases, the bluelink 'E' targets {{Narnia}} in edit mode, so one must use 'Edit' in the wikipedia framework to edit the latter.
I don't know that {{Narnia characters}} should exist; there is a Characters section in {{Narnia}}. But I should know what breaks if name differs from the pagename. I have noticed other examples recently, when I have visited some templates for other purposes. I have also suggested moving a couple of Templates, an action that must sometimes, may often be the origin of these differences. --P64 (talk) 17:26, 30 May 2012 (UTC)
Any template which provides links to directly access the template or its talk page (commonly via the {{navbar}} template) needs to be told exactly which template is to be edited through those links. With templates built around the {{navbox}} construct, this is the |name= parameter. It might be thought that a magic word such as {{PAGENAME}} could be used instead: but that yields the name of the outermost container, i.e. the name of the article into which the template is transcluded.
{{Narnia characters}} had |name=Narnia instead of |name=Narnia characters in error - this was not as a result of a page move, most probably the navbox had been copied from {{Narnia}} without attending to all the necessary amendments. I have fixed {{Narnia characters}}. --Redrose64 (talk) 17:48, 30 May 2012 (UTC)
Thanks. Visiting the wrong template talk will sometimes not even be noticed (as I quickly noticed editing the wrong template). So I will try to recall other mismatches i have noticed. If i understand correctly, this does need to be edited manually when a template is moved; the template talk will be moved automatically but the navbar of the display will link to the redirect talk. (I won't move any template until someone confirms or corrects, or until I read further and understand.) --P64 (talk) 18:37, 30 May 2012 (UTC)
You are quite correct: if a navbox (or any other template containing v-t-e links) is moved, the |name= (or equivalent) must be amended to match the new name. --Redrose64 (talk) 19:13, 30 May 2012 (UTC)
Yes. Template:Navbox#Setup parameters explains it. I have fixed many wrong name parameters in navboxes and considered whether to ask for a bot to look for them. Moves is one reason they become wrong. Another reason is editors who think it should be something describing the navbox and not necessarily the actual name. PrimeHunter (talk) 00:13, 31 May 2012 (UTC)
Workaround for parameter expansion in XML-style extension tags?
As the article mention, parameters do not get expanded when they are inside nowiki tags or XML-style extension tags. Well, what if you really do want to expand a parameter inside of a pair of XML-style extension tags, for example? Is there some workaround which can make that work? —Kri (talk) 11:08, 7 June 2012 (UTC)
I have started a discussion at WT:Citing sources#Content in templates concerning the need for purportedly factual information contained in citations to be cited, the difficulty in doing so, and the difficulty of marking a template as not having adequate citations. Jc3s5h (talk) 17:23, 5 September 2012 (UTC)
Passing template code as parameter so that template prints code and rendered version
I am trying to create a template that has a single parameter. The template will be passed template code as the value of that parameter. I would like the template to print the passed code itself and also print the rendered version. My initial attempts have shown that the nowiki tag does not work as WP:NOWIKI helped illuminate. I still do not know if there is a way to do what I am attempting. Jason Quinn (talk) 03:07, 5 October 2012 (UTC)
No. That template still requires a duplicate of the code to be entered. I was trying to make it such that the code only have to be entered once. I suspect it is not possible. Jason Quinn (talk) 18:35, 9 October 2012 (UTC)
How to get horizontal stacking of side templates with the shorter one first?
I'm not sure if this is the right place for the following question. If not, please tell me where to go. The problem arises at National accounts. If I list the short template first, they stack horizontally -- a bad outcome:
National accounts or national account systems (NAS) are the implementation of complete and consistent accounting techniques for measuring the economic activity of a nation. These include detailed underlying measures that rely on double-entry accounting. By construction such accounting makes the totals on both sides of an account equal even though they each measure different characteristics, for example production and the income from it. As a method, the subject is termed national accounting or, more generally, social accounting.[1] Stated otherwise, national accounts as systems may be distinguished from the economic data associated with those systems.[2] While sharing many common principles with business accounting, national accounts are based on economic concepts.[3]
^Joel S. Demski, 2008. "accounting and economics," The New Palgrave Dictionary of Economics. Abstract.
If I reverse the order of the templates, they stack horizontally vertically, which is good, but the order is misplaced. One fix is to move down the (long) Econ sidebar a couple of sentences. Vertical stacking of templates results, which is good, but at the cost of creating an undesirable paragraph break at that point. Is there any way of getting the short template to list first without breaking the paragraph? Thank you. --Thomasmeeks (talk) 11:37, 21 November 2012 (UTC)
This is one possible fix; it's not ideal, since there is a blank vertical strip to the left of the {{Economics sidebar}}, but I consider that it's less undesirable than a blank space above the lead paragraph. --Redrose64 (talk) 12:01, 21 November 2012 (UTC)
I would also like to know if it's possible to have a template bounce back an error in the event the user doesn't subst it. (This particular template must be substituted or it will transclude to the wrong page as soon as midnight comes and goes). Thanks. kcylsnavS{screechharrass} 22:07, 29 December 2012 (UTC)
Great, I'll see if I can find that code. Another question. My template has within it {{subst:#time...}} so when I save it the code is messed up. How do I prevent the substitution within the template code itself? safesubst:, I guess. Thanks - no longer watching this page. kcylsnavS{screechharrass} 22:36, 29 December 2012 (UTC)
Arg function
The #arg function explained in See also section seems it is not working. If I try {{#arg:uselang|default}} it is rendered as wikitext. --Vriullop (talk) 10:29, 26 January 2013 (UTC)
it is possible to check if a page exists or not using {{ifexists| |}}. Is it possible to check when the page exists if it is a redirect page or not?--Traveler100 (talk) 07:28, 15 February 2013 (UTC)
Templates and internal consistency of national varieties of English
I recently changed Forty Martyrs of England and Wales to have a consistent spelling of the word "canonize/canonise" throughout.[2] It seemed a little counter-intuitive to use -ize in an article on a British topic, but since the topic pre-dates standardization of either British or American spelling, I figured it would be okay, and from my understanding both spellings are actually acceptable in British English, just -ise is more common. Also, the very first version of the article had been written with the -ize spelling. I was soon reverted rather sloppily, though.[3] This revert ignored all the places in the article where -ize was still in use, and reintroduced inconsistency to the article. I then fixed this with another edit to remove all but one instance of -ize.[4] The remaining instance is, unfortunately, part of Template:Infobox martyrs, which uses the "American spelling" in every article in which it is used. Any idea how to get around this? elvenscout742 (talk) 08:14, 19 February 2013 (UTC)
I asked this before but wasn't able to find an answer that worked. Help?
I have been having an issue with my infobox template. When I make a header for a section in my infobox template (e.g.
|-
! colspan="2" style="background-color:#C0C0C0; color:black;" |Measurements
|-
) it works fine, and appears. But if I use the infobox for a character who doesn't have info for a section (e.g. no measurements were provided), the section header appears anyways, even though nothing is under it. I found a page on another wiki that has a template that does the same sort of thing mine does. My template would look kind of like this one, if I use it for a character who doesn't have the info supplied. you see, the appearence section should appear, since there is info there. But, there are no stats, but the section header still appears. Is there a way to hide it? So that the template doesn't show it if there's nothing under it used. 98.217.230.157 (talk) 20:59, 3 March 2013 (UTC)
At Wikipedia, this is typically done using the #if parser function. See, for example, {{Infobox album}}, which arranges for "header13" not to be displayed if there isn't going to be anything underneath it. If you can't make this work, I suggest you ask at the MediaWiki support pages, since this page is really only about template usage at the English Wikipedia. -- John of Reading (talk) 07:09, 4 March 2013 (UTC)
Can someone help me by fixing some templates? I can't see all of the following templates in Internet explorer (the template's border goes past right of the screen), and fixing this is beyond my knowledge.
* [[Image:Australian National Route 1.svg|17px|(1)]] [[Bass Highway, Tasmania|Bass Highway]]
which I assume are road numbers. By contrast, in {{Hobart suburbs}} the only image is the flag in the title; and {{Hobart landmarks}} doesn't have any images at all.
Hi. I'm an experienced content editor, but I have virtually zero background in template coding. I'm a template user, but a complete novice when it comes to coding. Is someone who is an experienced coder available and willing to help with the modification of the coding for an existing complex template (an infobox), and also able to create a visually representative mock-up of same before it goes live? If you are able and willing to help, please fee free to leave a response here or on my user talk page. Thanks. Dirtlawyer1 (talk) 19:51, 22 March 2013 (UTC)
Tech13, are you a serious geek? Because I need a good one! LOL
The template in question is Template:Infobox NFL player. It's big, too big, in fact, and will need to incorporate even more new elements to better its future use for NFL coaches as well as NFL players. To my way of thinking, that will require a review and possible deletion of some elements in order to have a better balanced infobox that does not overwhelm article text when most of the optional elements are used.
The ability to produce a mock-up will also be key, because the finished product will need to be approved by a consensus of WP:NFL editors. This will also require some patience with humans, as well as the technical skill to produce the final product. Still interested? Dirtlawyer1 (talk) 20:16, 22 March 2013 (UTC)
Well qualified, indeed. LOL Ping me on my user talk page after you've had a look at it. We may want to move to email at some point for more efficient communication. In what time zone do you live? Dirtlawyer1 (talk) 21:22, 22 March 2013 (UTC)
What exactly do you want to add/change? I noticed on that template some of the argument names are confusing. Those could easily be cleaned up. If I'm reading you your above comment right, wouldn't it be better to add a separate infobox template for coaches? Then you could slim out all of the coach stuff that may or may not be used, and just add the second template when it is needed. Would reduce page load times on pages where the player hasn't coached anything yet. — User:Technical 13 ( C • M • Click to learn how to view this signature as intended )11:57, 23 March 2013 (UTC)
Query with creating a template
Hi. I'm not sure if this is the right place to ask this question - if there's a better place I'd be grateful if you could direct me there. Thanks.
I'm trying to create templates (Template:Fb_cl_header_H&A and Template:Fb_cl_team_H&A) for football league tables where both home and away results are given, as there don't seem to be any such templates already available, and the league tables that give home and away info look less than great as they're presented at the moment (eg. here and here). I'm nearly there, but there's a couple of problems right at the end that I just can't solve.
I think the table really needs three slightly heavier vertical lines to visually separate out the home and away results. I've managed to get those in by altering the borders of the HW, AW and GD columns, but for some reason it is automatically also changing these three columns to give them (a) bold font, and (b) a darker background when the background colour isn't specified. So the top of the table looks like the below. I cannot work out why it is doing these two things, or how to stop it. Any suggestions would be much appreciated. Thanks. Mmitchell10 (talk) 20:38, 1 April 2013 (UTC)
{{Fb_cl_header_H&A}}
{{Fb_cl_team_H&A |p=1 |t=Aldershot Town|hw=18|hd=2|hl=3|hgf=44|hga=21|aw=13|ad=6|al=4|agf=38|aga=27 |bc=#CCCCFF|promoted=y|champion=y}}
{{Fb cl3 qr |transfer=y|rows=1|competition=Promoted to [[The Football League 2008-09#League Two|League Two]]|bc=#CCCCFF}}
{{Fb_cl_team_H&A |p=2 |t=Cambridge United|hw=14|hd=6|hl=3|hgf=36|hga=17|aw=11|ad=5|al=7|agf=32|aga=24|bc=#FFE4B5}}
{{Fb cl3 qr |transfer=y|rows=4|competition=Qualified for [[2007–08_Football_Conference#Play-offs|play-offs]]|bc=#FFE4B5}}
{{Fb_cl_team_H&A |p=3 |t=Torquay United|hw=15|hd=3|hl=5|hgf=39|hga=21|aw=11|ad=5|al=7|agf=44|aga=36|bc=#FFE4B5}}
{{Fb_cl_team_H&A |p=4 |t=Exeter City|hw=13|hd=9|hl=1|hgf=44|hga=26|aw=9|ad=8|al=6|agf=39|aga=32 |bc=#FFE4B5|playoffwinner=y|promoted=y}}
{{Fb_cl_team_H&A |p=5 |t=Burton Albion|hw=15|hd=3|hl=5|hgf=48|hga=31|aw=8|ad=9|al=6|agf=31|aga=25|bc=#FFE4B5}}
{{Fb_cl_team_H&A |p=6 |t=Stevenage Borough|hw=13|hd=5|hl=5|hgf=47|hga=25|aw=11|ad=2|al=10|agf=35|aga=30}}
{{Fb_cl_team_H&A |p=7 |t=Histon|hw=10|hd=7|hl=6|hgf=42|hga=36|aw=10|ad=5|al=8|agf=34|aga=31}}
{{Fb_cl_team_H&A |p=8 |t=Forest Green Rovers|hw=11|hd=6|hl=6|hgf=45|hga=34|aw=8|ad=8|al=7|agf=31|aga=25}}
{{Fb_cl_team_H&A |p=9 |t=Oxford United|hw=10|hd=8|hl=5|hgf=32|hga=21|aw=10|ad=3|al=10|agf=24|aga=27}}
{{Fb_cl_footer |u= |s=
}}
Is there a test to see if a section exists in a page, similar to {{#ifexist: |}}, but for sub-section of a page rather than the page? --Traveler100 (talk) 15:30, 7 April 2013 (UTC)
Where and how do you want to use it? Depending on what you want to do, and who you want to be able to see it, you may be able to write a JavaScript that calls the API to get the section headers. I know this exists, but I'm not entirely sure how it works myself. If this is something you are interested in, I could find someone that knows something more about it and put you in touch. Technical 13 (talk) 12:52, 8 April 2013 (UTC)
Horizontal version of the vertical shortcut box {{shortcut}}
Is there any function or reference template for counting the number of items in an ordered list? (E.g., returning the number "13" from a numbered list of 13 items.) czar··00:31, 9 May 2013 (UTC)
Not directly on this Wikipedia using templates. There "may" be a Lua module that can be used, I'm unsure but could Look into it tomorrow for you. If it is on anoyher wiki, it is possible to do if the right extensions are installed. I've done it using the mw:extension:variables extension (can link later if that's not right...) on http://ddowiki.comTechnical 13 (talk) 00:58, 9 May 2013 (UTC)
Hello again czar if you are still following this thread. I followed up on the Lua possibility, and you can find the response I received from the Lua people here. Happy editing! Technical 13 (talk) 11:32, 10 May 2013 (UTC)
Sounds good. Thank you for the update. The Lua suggestions are a bit too involved for my use, but you helped me find the bottom of the rabbit hole. Hopefully someone finds that thread equally useful in the future. czar··05:17, 11 May 2013 (UTC)
Template with chart and caption
I am trying to create a template with a chart with an optional caption. Like so here: Template:Subschools of Vedanta. Unfortunately, for longer captions, I have been unable to enforce text wrapping to make the template retain the width of the chart. Any help is greatly appreciated. (I have also placed the same request here. Thanks. Chaipau (talk) 13:59, 13 May 2013 (UTC)
You can either force the width of the table in the template, or let the user handle it. You could do that with either an optional parameter for table width, or the user can just pass a line break (<br />) in with the caption where needed. You could use a text overflow scrollbox, but that would be pretty ugly I think. — Bility (talk) 15:49, 13 May 2013 (UTC)
Thank, I might have to use </br> as a last resort. But is it not possible to take a hint from the width of the chart? The chart is in a cell in a wikitable. The caption is in a cell below it. Maybe this is a wikitable question now! Chaipau (talk) 18:20, 13 May 2013 (UTC)
Since we don't know the width of the table until it renders and it renders at a width to accommodate the caption, I don't think there is a way to do that with templates. Your best bet is probably to use a |width= parameter that allows the user to set the table width explicitly if they don't want the caption expanding it. — Bility (talk) 19:54, 13 May 2013 (UTC)
What would your table look like as an unordered list? I think the best way to answer your question is to build the table. For example, your list above would look like:
Ah, I mean the tree that you see in the template (Template:Subschools of Vedanta) is created using the chart template (Template:Chart). I am not trying to create something else. I am just trying to modify this template so that I may use it in different articles with their own (possibly lengthy) captions. Chaipau (talk) 10:53, 14 May 2013 (UTC)
Thank you All the help is much appreciated. I finally implemented it with a nested table with a fixed width! Chaipau (talk) 22:23, 14 May 2013 (UTC)
Congrats on solving your problem, however three levels of nested tables is not very good coding practice, not to mention some other oddities. Table cells can have their widths set directly, no need to put a table inside of them to do that. {{Subschools of Vedanta}} has its chart hardcoded, why not just explicitly define the width of one table, since it will only ever be one size? I cleaned it up a bit, so you can see the difference. If you really wanted that box-within-a-box look that came from nesting tables, you could add a border style directly to the cell the chart is in. — Bility (talk) 23:50, 14 May 2013 (UTC)
Thanks, the code is much cleaner now and easier to work with! I wanted to keep the width of the chart undefined, but this definitely works. Yes, I shall put in the box-within-a-box look as you suggest. Chaipau (talk) 10:46, 15 May 2013 (UTC)
Template:Infobox referendum
Can someone with the necessary know-how sort this template out so that the map section is an optional input. In several articles (e.g. here) there are no maps, and it leaves an unfilled section of the template on the page. Cheers, Number5711:05, 17 May 2013 (UTC)
No problem, I've further expanded the fix so that if there is no map used, it doesn't show the "by district" section at all. I think that looks better. Comments? Technical 13 (talk) 12:41, 17 May 2013 (UTC)
Could someone with more experience with templates than myself please take a look at {{SharedArms}}? The template page was wonky, so I fixed that but then the code produced by the template in articles went wonky. Looking at the template's code, I have my doubts that this is the most efficient way to make this template work, but I don't usually write templates and this one is a bit over my head. Thank you! Wilhelm Meis(☎ Diskuss | ✍ Beiträge)19:13, 6 July 2013 (UTC)
Thanks, John! It looks like this template has needlessly complicated parameters. I'd like to simplify it, if I knew how, to create a shell text with linked variables that would function essentially like {{About}}, accommodating up to twelve variables. This would allow template users to list the names of entities with conflicting arms (with piping) in the template. Thus {{SharedArms|Artres|Bettrechies|Cerfontaine|Denain|Eth|Lesquin|Obies|Quérénaing|Semousies|Wambrechies|Warlaing}} would produce:
(Artres, Bettrechies, Cerfontaine, Denain, Eth, Lesquin, Obies, Quérénaing, Semousies, Wambrechies and Warlaing use the same arms.)
Does anyone know a relatively easy way to set that up? Wilhelm Meis(☎ Diskuss | ✍ Beiträge)02:50, 7 July 2013 (UTC)
On second thought, that would probably be more trouble than it would be worth. Probably a lot easier just to write new conflicts into this template in the existing format as they become known. It was a nice idea, though. Wilhelm Meis(☎ Diskuss | ✍ Beiträge)03:36, 7 July 2013 (UTC)
Pass parameter into a transcluded template
I am 99% sure this is possible, but I have tried all sorts of combinations to no avail. I have a template here and some test cases here. Whilst the generation of the tables works as expected, I am trying to make it so I can pass {{{type}}} and {{{accessdate}}} from my template down into the citation templates. At the moment the parameter values are getting lost in the transclusion. Could anyone please provide assistance? Themeparkgc Talk 08:26, 20 August 2013 (UTC)
I'm drafting a template with a parameter that takes a manually-entered string as a value. If the string includes "{{!}}", the rendering depends on whether it is in a URL or not. If it is, the rendering is as "%7C"; but if is not in a URL, the rendering is as "|". In a test, I found that a URL (a different one) does not necessarily resolve percent-encoding to the unencoded form so the intended address can be reached (tested by percent-encoding either the dot before "com" or a letter); the Internet service provider was unable to determine what destination I wanted and sent me some advertising instead. How can I make the parameter display the literal result of the "{{!}}" template even if embedded in a URL, just as happens when there's a string without a URL? Nick Levinson (talk) 21:10, 25 August 2013 (UTC) (Linked template draft: 21:24, 25 August 2013 (UTC)))
Sorry, you're going to have to give some more information: like, which template are you trying to amend; and what you want doing to it. --Redrose64 (talk) 22:47, 10 September 2013 (UTC)
I was excited to see that we can now embed Lua code into templates, but the documentation for Wikipedia-specific usage is rather anemic (unless I'm looking in the wrong places). Is there a means of (for example) using Lua to detect the reader's screenname or IP address and generate text accordingly? I always thought that would be useful for certain things. Ryn78 (talk) —Preceding undated comment added 17:53, 11 October 2013 (UTC)
I'm planning on creating a template that can deal with one- and two-round elections, but don't want the second round columns appearing when the election only has a first round. This is currently done using varieties of Wikitables that combine some cells in the header row, and then combines all the second round cells for candidates that didn't qualify for the second round (if that doesn't make any sense, see here) so I'm not sure whether it would be possible to create a template that could have such functionality. Basically I want it to be able to do this if there's only one round:
Candidate
Party
Votes
%
or this if there's two:
Candidate
Party
First round
Second round
Votes
%
Votes
%
Ideally the template would have code along the lines of
Forgive me, I don't know if I'm using the correct terminology; I'm trying to work with a pre-defined type of table called "Track Listing". I see that one column can be added by calling it "extra_column". Entries in each line of it are then defined with "extra1 =", "extra2 =", etc. How, then, can additional columns be added? Is there a way to control the "Title" column so that it does NOT generate quotation marks? Thanks. 108.1.71.99 (talk) 06:19, 2 December 2013 (UTC)
The template is actually {{Track listing}}, small "l". It provides a maximum of six columns, of which one is the "extra" column. The quotemarks around titles are hardcoded into the subtemplate {{Track listing/Track}} and cannot be suppressed - their presence is required by MOS:ALBUM#Track listing.
A far, far better question is, why NOT? At any rate, one extra column already exists in the track listing on the page, "Lead vocals"; and the total number of columns being USED is less than the six allowed. (I didn't know how to bring up the definition page you have shown me -- as it is, I don't SEE a mention of the six-column limit; if it's there, it's hard to spot -- not that it's a bad idea anyway.) I also wanted to add a "Source" column, as the album is a compilation of songs from different radio broadcasts, presented in a very "scrambled" order. The sources are listed BELOW the table, but I wanted to have the sources shown ON each song, as the next column after "Title", as it is secondary to title in identifying each track, as the same song was often performed on multiple occasions (but this should not be attached parenthetically like a "note" -- although I see that's how it WAS done in the example "Greatest Hits by Queen" -- UGH! -- all the more evidence of the need for a specific "Source" option!) I actually visited the article expressly hoping to have this "handy" information to view, only to find it most UNhandy -- and it's the perfect sort of info to incorporate in the table, as the Queen example attests. (And as it is, there is on the page in question a serious track-numbering discrepancy between the track-list table and the source list below, stemming from it being a two-disc set.) 108.1.71.99 (talk) 17:04, 2 December 2013 (UTC)
The six-column limit is merely because the template does not provide for any more. Consider the parameters that are provided for the first row:
Of these seven, only four go directly into their own columns: these are |lyrics1=|music1=|extra1=|length1=. Three cannot appear simultaneously: |writer1=, if enabled by use of |writing_credits=yes, forces |lyrics1= and |music1= to be ignored. Two are shown in the same column: |title1= and |note1=. That gives five columns; the sixth is the track number. Here is a fictitious example using the maximum of six columns:
Thank you; I see that you have taken those steps. I guess I'll state "formally" that I'm requesting an additional OPTIONAL column to appear right after the "Title" column, to be called "Source", although I might also dare suggest that this be merely its default name, and that "source_column = " could be invoked to have a different heading appear, if deemed appropriate for some other purpose, or some refinement of the purpose. I'm all for versatility. Anyroad, "Source" is potentially useful for many of your typical "Greatest Hits/Best of" albums, as in the displayed example "Greatest Hits by Queen"; but its usefulness is by no means LIMITED to those albums; e.g., I was hoping to incorporate "Source" for an album of songs culled from different radio broadcasts. 108.1.71.99 (talk) 00:07, 3 December 2013 (UTC)
Wait, are you talking about a legitament "Source" a.k.a. Reference? Or are you referring to something like "Appears on" or "Recorded from some live broadcast" type of "sources"? If it's the latter, then couldn't "Note" be used? If it's the former, then I have suggested a few times to add a "title_ref1=" type of option which would allow you to put references for titles that would be placed outside of the qoutes of titles. The TV Episode template allows for this, so I'm sure it's possible to be done. – Mizery Made(talk · contribs)03:23, 3 December 2013 (UTC)
I'm talking about the latter -- source-of-item -- and stylistically, "notes" attached parenthetically to the title itself are vastly inferior to a proper COLUMN to denote the information; such particles of information as are to appear on EVERY line ought properly to have their own column. 108.1.71.99 (talk) 06:29, 3 December 2013 (UTC)
I have had a similar problem when using this template for compilation albums. Taking FabricLive.59 as an example, I want the column headings to be |title1=|artist1=|label1= and |length1=, which makes perfect sense for "various artists"-type compilations. Not all of those are possible at the same time since two of these are non-standard headings for the template, and there is only one "extra" option. My view is that the ideal solution would be to allow multiple |extra1= -type columns, which should cover everybody's needs in situations like this. That said, I know absolutely nothing about coding templates and so I have no idea if this is possible, but I would welcome that additional functionality. — sparklism hey!09:04, 3 December 2013 (UTC)