Help talk:Template/Archive 3

Latest comment: 10 years ago by Sparklism in topic Track Listing Tables
Archive 1 Archive 2 Archive 3 Archive 4 Archive 5

Can't edit a template

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)

Ok, so I see where it is to edit it, but the little e goes to the wrong page, Template:ASVEL_Lyon-Villeurbanne_roster, which doesn't exist. How do I change that? --AW (talk) 20:31, 24 March 2011 (UTC)
Obviously not by creating a redirect, that didn't work. Help? --AW (talk) 20:34, 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
#REDIRECT [[Template:ASVEL Lyon-Villeurbanne]]
It seems to be something within the {{Euroleague roster header}} template that is causing it to set up the v-d-e links to point to Template:ASVEL Lyon-Villeurbanne roster instead of to Template:ASVEL Lyon-Villeurbanne. I need to look deeper. --Redrose64 (talk) 21:06, 24 March 2011 (UTC)
Yep. It's expecting the template name to be "Template:Xxxx roster", where "Xxxx" is the team name displayed in the top bar. This means that there will be similar problems affecting most of these templates, at least the ones which don't end in "roster" anyway. So, Template:Menorca Bàsquet exhibits the same problem, whereas Template:Panathinaikos BC roster is fine. --Redrose64 (talk) 21:16, 24 March 2011 (UTC)

Includeonly

For meta-templates, is it possible to includeonly an includeonly tag? McLerristarr | Mclay1 06:24, 7 February 2011 (UTC)

I don't think you can. I tried:
<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)
Pretty much, yes. Thanks for trying. Templates are quite good now but I guess some things are just impossible. McLerristarr | Mclay1 14:43, 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 | Mclay1 17: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 | Mclay1 17: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)
No, I don't want to substitute. Anyway, thank you for the help. I'll just have to find a way around it. McLerristarr | Mclay1 18:00, 24 February 2011 (UTC)

This was reported as a bug here: https://bugzilla.wikimedia.org/show_bug.cgi?id=29889 If it is important to you, click "vote". Badon (talk) 23:56, 7 August 2011 (UTC)

Template not appearing in category

I've looked at this but I just can't see why it isn't working - could someone have a quick look at Template:Mabs please and tell me why it doesn't appear in Category:Mathematical formatting templates. Thanks. Dmcq (talk) 12:04, 2 April 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)
Thanks very much. I was asking myself what on earth have I done and scratching my head. Dmcq (talk) 21:38, 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)

Can you explain it with real templates? I presume you don't mean the actual templates {{TA}} and {{TB}}?--Kotniski (talk) 10:31, 27 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.

I hope that is enough detail. -- PBS (talk) 01:05, 28 March 2011 (UTC)

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
--Redrose64 (talk) 17:27, 28 March 2011 (UTC)
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:
{{{1|{{{wstitle|{{{wikisource|{{{article|{{{title|}}}...
is a very large nested test the best way to do this, or is there a better/clearer method? -- PBS (talk) 21:32, 28 March 2011 (UTC)
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:
Print in Test:Print Hello 2
Print in Test:Print Hello 1
These are clearly different (the template {{User:Redrose64/test}} is a straight copy of your test template prior to the 18:16 amendment).
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}}.
I did suggest to Kotniski (talk · contribs) (see here) that this absent/blank non-equivalence be mentioned, but I can't find it. --Redrose64 (talk) 21:57, 28 March 2011 (UTC)
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)

After the above exchange, I came across mw:Help:Parser functions in templates and mw:Help:Extension:ParserFunctions that are useful explanations of the difference between an empty parameter, and one that has not been set, and how that affects different tests. -- PBS (talk) 23:18, 20 October 2011 (UTC)

CPJ Award winners

I've been trying to create templates for a few human rights/freedom of expression awards today, including Template:Footer Gwangju Prize for Human Rights laureates and Template:Footer Homo Homini Award laureates, which went well, and Template:Footer CPJ International Press Freedom Award laureates, which is going very badly due to the number of past winners (4-6 a year for twenty years). Would anyone with more experience in templates be willing to take a look at the latter and let me know if they have a formatting suggestion that would make this template more attractive and/or helpful? Or should I just give this one up as a lost cause? Thanks, Khazar (talk) 07:15, 24 May 2011 (UTC)

Problem resolved. Khazar (talk) 20:11, 24 May 2011 (UTC)

passing parameters in nested templates

Hi,

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?

Thanks, — kwami (talk) 21:52, 3 June 2011 (UTC)

  Done You were passing the third positional parameter into the documentation, not into the {{IPA audio link}} template. Have fixed it. --Redrose64 (talk) 22:36, 3 June 2011 (UTC)
Thanks. I feel like Homer Simpson. — kwami (talk) 23:31, 3 June 2011 (UTC)

Choice of example template

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)

Do you have any suggestions? --Redrose64 (talk) 16:54, 13 August 2011 (UTC)
I have boldly replaced it with {{lambda}}.--Fuhghettaboutit (talk) 22:13, 13 August 2011 (UTC)
Fine; I was considering {{theta}}. --Redrose64 (talk) 22:36, 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.
Every template has a discussion page. Is there a particular template that has issues? ---— Gadget850 (Ed) talk 03:30, 24 August 2011 (UTC)
Thanks for the responses! Two templates:
  1. 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.
  2. 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)
{{Country data Switzerland}} uses an odd sort of doc page generated by {{Country showdata}}; most templates include {{documentation}} which generates sandbox and testcases links at the end. See {{r}} for example. Regardless, you can create a sandbox at {{Country data Switzerland/sandbox}} and use it for testing. ---— Gadget850 (Ed) talk 02:44, 29 August 2011 (UTC)

Avoiding unused values

While using the templates, if any values are unused then the template shows the variable itself like

Current programmes and activities: Blah, blah
Defunct Promotions	{{{defunct-promotions}}}

I was wondering if we could avoid showing the variable and make it look like the one below.

Current programmes and activities: Blah, blah

— Preceding unsigned comment added by Dextermmm (talkcontribs) 07:50, 30 August 2011

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.

{{{defunct-promotions<includeonly>|</includeonly>}}}

Although this still shows the string "Defunct Promotions", the variable is blank and it looks better.

Current programmes and activities: Blah, blah
Defunct Promotions 

It would be even better if you could give an example of the if function. Thank you.

Here's a code fragment from {{Infobox planet}}:
{{#if:{{{discovery_site<includeonly>|</includeonly>}}}
     |<tr><th style="line-height:1.1em;">Discovery site</th>
          <td style="line-height:1.2em;">{{{discovery_site}}}</td>
      </tr><!--
-->}}
The "if" logic says that if a "discovery" parameter was passed in with a non-blank value, then put out the label "Discovery site" and then the value of the parameter; and otherwise omit both. You'll find some documentation on "if" at Help:Parser function#Conditional expressions. -- John of Reading (talk) 16:05, 30 August 2011 (UTC)

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)

See also WP:TEMPLATECAT. --Redrose64 (talk) 17:16, 13 September 2011 (UTC)
Perfect. Thanks! Jason Quinn (talk) 19:19, 13 September 2011 (UTC)

Template code needs work

I used {{Meteorology by year}} to create {{environment by year}}. They are putting the first year of the century in the wrong century. Is it a fault with the code? Can it be fixed? -- Alan Liefting (talk) - 07:02, 21 January 2012 (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?

Thanks, Trafford09 (talk) 15:32, 25 January 2012 (UTC)

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)

Some tweaking needed

I created Template:Environment by year but it creates the wrong grammar for future years. See Category:2015 in the environment for example. Embarrassing!! It could be fixed with some conditional statements and {{show by date}}? -- Alan Liefting (talk - contribs) 04:22, 20 February 2012 (UTC)

  Done, see here. --Redrose64 (talk) 11:11, 20 February 2012 (UTC)
"Oh that is just beautiful", said Alan wiping a small tear of joy from his eye... Cheers for that. -- Alan Liefting (talk - contribs) 19:30, 20 February 2012 (UTC)

comparing dates in non-numeric parameters

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,

{{#ifexpr: {{CURRENTYEAR}} - {{#sub:{{{speakersdate}}|0|4} }} > 30|[[category:X]]}}

produces an error, whereas

{{#ifexpr: {{CURRENTYEAR}} - {{{speakersdate}} > 30|[[category:X]]}}

works fine so long as 'speakersdate' is purely numeric.

Can anyone think of a workaround?

Thanks. — kwami (talk) 07:57, 12 November 2011 (UTC)

Add a field to the language infoboxes for categorization date and use that. — Bility (talk) 17:33, 12 November 2011 (UTC)
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)
You can format the date using #time and check for error using #iferror. ---— Gadget850 (Ed) talk 23:12, 11 March 2012 (UTC)

Tables as parameters

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 (talkcontribs) 03:51, 5 February 2012 (UTC)
The simplest way to do this is to make the table markup a subtemplate, avoiding the entire issue. See {{markup}}, which creates the rows by transcluding {{markup/row}}. ---— Gadget850 (Ed) talk 23:06, 11 March 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.
I've begun a discussion at Wikipedia talk:Help desk#Help:Help desk as to whether this extra help desk is a good idea. -- John of Reading (talk) 07:53, 12 March 2012 (UTC)
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)
(More) No, this is too subtle for me, too. -- John of Reading (talk) 10:09, 12 March 2012 (UTC)
That edit is a step in the right direction but I want to see the info at [1] preloaded into the edit. -- Alan Liefting (talk - contribs) 18:31, 12 March 2012 (UTC)
I've done that bit, and, I hope, arranged for the edit window to contain four tildes. -- John of Reading (talk) 19:52, 12 March 2012 (UTC)

Noinclude, includeonly, and onlyinclude

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:

{{#if:{{#pos:{{lc:{{PAGENAMEE}}}}|loot}}||{{#if:{{#pos:{{lc:{{PAGENAMEE}}}}|named}}||{{#if:{{#pos:{{lc:{{PAGENAMEE}}}}|reward}}||{{#if:{{#pos:{{lc:{{PAGENAMEE}}}}|named_items}}||{{#ifeq:{{lc:{{TALKSPACEE}}}}|{{lc:{{NAMESPACEE}}}}||{{#switch:{{lc:{{NAMESPACEE}}}}|category|file|forum|help|template|user=|#default=<includeonly>[[Category:{{ #ifeq:{{lc:{{{3}}}}}|exc| Exceptional ||}} {{#switch:{{lc:{{{1}}}}} |str|strength = Strength |dex|dexterity = Dexterity |con|constitution = Constitution |int|intelligence = Intelligence |wis|wisdom = Wisdom |cha|charisma = Charisma |ability = Ability |Stat (str, dex, con, int, wis, cha) }} {{ #ifexpr:{{{2|0}}}< 0|{{#expr:0+{{{2|0}}}}}|+{{#expr:0+{{{2|0}}}}}}} items]]</includeonly>}}}}}}}}}}}}

However, I can't seem to figure out how to make the page that calls it using {{:Category:A_Small_Problem_loot}} not be in C:Wisdom -1 items. I only want the pages in C:Items to be added to C:Wisdom -1 items (or other appropriate 'C:Stat_+/- amount_items'). How do I do this? Technical 13 (talk) 19:19, 16 March 2012 (UTC)

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)
Just to be clear, are you trying to get A Small Problem out of Category:Wisdom -1 items? — Bility (talk) 20:44, 16 March 2012 (UTC)
Correct. -- Technical 13 (talk) 22:12, 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:
     {| 
     |- 
     ! style="background-color:#C0C0C0; color:black;" |Measurements
     ! style="background-color:#C0C0C0; color:black;" |Stats
     ! style="background-color:#C0C0C0; color:black;" |Birthday
     |- 
     | {{{measurements|}}}
     | {{{stats|}}}
     | {{{birthday|}}}
     |}
You would have to use...
     <table>
          <tr>
               {{#if:{{{measurements|}}}|<td style="background-color:#C0C0C0; color:black;">'''Measurements'''</td>}}
               {{#if:{{{stats|}}}|<td style="background-color:#C0C0C0; color:black;">'''Stats'''</td>}}
               {{#if:{{{birthday|}}}|<td style="background-color:#C0C0C0; color:black;">'''Birthday'''</td>}}
          </tr>
          <tr>
               {{#if:{{{measurements|}}}|<td>{{{measurements|}}}</td>}}
               {{#if:{{{stats|}}}|<td>{{{stats|}}}</td>}}
               {{#if:{{{birthday|}}}|<td>{{{birthday|}}}</td>}}
          </tr>
     </table>
Good luck -- Technical 13 (talk) 02:33, 1 April 2012 (UTC)

Changing existing field in a template?

I would like to make a couple edits to the {{Infobox WCBB Team}}

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.

How can I do this?--Sphilbrick(Talk) 13:54, 14 April 2012 (UTC)

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)
Not totally sure, but I'll try it in a sandbox. Thanks.--SPhilbrick(Talk) 16:41, 14 April 2012 (UTC)

Help

The widths on Template:L. Frank Baum are excessive. I think removing all those subtitles may help, but I don't want to bother if it's not going to reduce the widths. --Scottandrewhutchins (talk) 14:07, 19 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 +).
Template:C. S. Lewis should sort to the top of Category:C. S. Lewis.
Category:Shakespeare templates should sort to the top of Category:Shakespeare.
[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)
Templates are not normally sorted under T but under Τ, which sorts after Z. See WP:SORTKEY which advises the use of the lowercase form, i.e. τ. --Redrose64 (talk) 17:42, 29 May 2012 (UTC)

Monitoring parameter usage

Just in case there are any (more) links leading to the section of this name, I ressurected it at template:voidd#Monitoring parameter usage from revision 276648202 (12 March 2009). The section is actually commented out in that revision. Vadmium (talk, contribs) 05:43, 29 May 2012 (UTC).

Pagename and name=

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)

Yes, use the {{#tag:}} parser function. For example, {{#tag:ref|}} is used in {{sfn}} to generate the <ref>...</ref> element. --Redrose64 (talk) 14:02, 7 June 2012 (UTC)
Thanks! —Kri (talk) 22:39, 7 June 2012 (UTC)

Allow a navigation footer in See also section?

F.Y.I. - this idea is being discussed at Layout. Butwhatdoiknow (talk) 12:37, 15 July 2012 (UTC)

Content in templates

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)

RfC notice

There is a Request for comment about the need/redundancy of Largest cities/city population templates. This is an open invitation for participating in the request for comment on Wikipedia:Requests for comment/City population templates. Should you wish to respond to the invitation, your contribution to this discussion will be very much appreciated! If in doubt, please see suggestions for responding. Mrt3366<stpan style="font-size:x-small">(Talk?) (New thread?) 10:33, 13 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)

Something like {{markup}}? ---— Gadget850 (Ed) talk 10:46, 7 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)
Correct. After my experiences developing {{markup}} and elsewhere, I added the template issues to WP:NOWIKI. ---— Gadget850 (Ed) talk 01:27, 10 October 2012 (UTC)

Template in a bulleted list

Why are these two templates: Template:PhilPapers, and Template:InPho not participating nicely in bulleted lists? They are templates that produce external links, and are meant to be in a bulleted list, but show up as not bulleted.Greg Bard (talk) 04:14, 12 October 2012 (UTC)

  Resolved
 – at the Help desk -- John of Reading (talk) 11:42, 12 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]
  1. ^ Nancy D. Ruggles, 1987. "social accounting," The New Palgrave: A Dictionary of Economics, v. 4, pp. 377–82.
  2. ^ United Nations, The System of National Accounts and National Accounts Data.
  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)
Also {{stack}}, which pretty much does the same thing. ---— Gadget850 (Ed) talk 12:27, 21 November 2012 (UTC)
I tried that, and it didn't work, at least in Firefox, until I added two more pairs of div tags:
{{stack|
<div>
{{JEL code|C82 and JEL:E01}}
</div>
<div>
{{Economics sidebar}}
</div>
}}
-- John of Reading (talk) 12:59, 21 November 2012 (UTC)
Ah, brilliant. I came to the right place. Nice fix. RR. Also good to know of more than one way to do it. Thank you. --Thomasmeeks (talk) 21:04, 21 November 2012 (UTC)

Teacher attention, please....

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)

Yes, that's what happens if you use {{proposed deletion}} instead of {{subst:proposed deletion}}. --Redrose64 (talk) 22:15, 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)

#arg is part of mw:Extension:DynamicFunctions which is not installed on Wikipedia; see Sepcial:Version for all installed extensions. I don't know why this is documented here and am removing it. --— Gadget850 (Ed) talk 11:07, 26 January 2013 (UTC)

if redirect

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)

This isn't listed at Help:Magic words, so I don't think this is possible. -- John of Reading (talk) 07:41, 15 February 2013 (UTC)
and {{ifexists| |}} doesn't work anyway. The correct parser function is {{#ifexist: |}} --Redrose64 (talk) 13:00, 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)

Replied at Template talk:Infobox martyrs. -- John of Reading (talk) 11:51, 19 February 2013 (UTC)

Hide section header if not needed?

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)
If your talking about what I think you are talking about, then you can't do it with wikitables. You will have to use parser function logic and HTML table/tr/td tags to make it work. You can see an example of this on one of my templates I have been working on: http://ddowiki.com/edit/Template:Named_Item T13   ( C • M • Click to learn how to view this signature as intended ) 12:55, 4 March 2013 (UTC)

Templates made for Firefox - not IE

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.


The correction of these templates would be much appreciated. Wiki ian 16:08, 11 March 2013 (UTC)

They display OK in Internet Explorer 7. Which version are you using? --Redrose64 (talk) 16:44, 11 March 2013 (UTC)
The long lines don't wrap in Internet Explorer 9. -- John of Reading (talk) 16:58, 11 March 2013 (UTC)
Ah. Is this one of those Compatibility mode vs Quirks mode issues that Microsoft has imposed upon the world? --Redrose64 (talk) 17:05, 11 March 2013 (UTC)
Ah yes, it looks good in IE 9 when I turn on compatibility mode. -- John of Reading (talk) 17:09, 11 March 2013 (UTC)
I was wondering if someone could make those templates like Template:Hobart suburbs or Template:Hobart landmarks so I don't need to turn compatibility mode on? Wiki ian 20:18, 11 March 2013 (UTC)
They're all built around {{navbox}} using the WP:HLIST styling. As far as I can see, the only significant difference is that {{Road infrastructure in Hobart}} and {{Road infrastructure in Tasmania}} have images within their titles, at their right-hand ends, and within most list items, i.e.
* [[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.
I have created Template:Road infrastructure in Tasmania/sandbox, which is thesame as Template:Road infrastructure in Tasmania but without the road number images; please check whether this displays properly. Failing that, I need to consider the |image= and |title= parameters. --Redrose64 (talk) 21:09, 11 March 2013 (UTC)
I think I've fixed both templates, as it turns out that Gadget850 solved this problem a year ago; see this help desk archive. -- John of Reading (talk) 21:16, 11 March 2013 (UTC)



Thankyou very much John of Reading. The changes you made are perfect. Kind regards, Wiki ian 21:18, 11 March 2013 (UTC)

Experienced template coder needed

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)

Sure, which template and what do you want it to look like? User:Technical 13   ( C • M • Click to learn how to view this signature as intended ) 19:59, 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)
I'm a geek that aspires to ascend to the level of full fledged nerd one day and be the ruler of my own nerd-dom. As for your template, I'll take a look as soon as I get home. User:Technical 13   ( C • M • Click to learn how to view this signature as intended ) 20:27, 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=
}}
Fixed. The ! prior to the style= creates a header cell (these are boldface by default), whereas a | prior to the style= creates a data cell (these are normal weight by default). More at Help:Wikitable - it's not a template issue at all. --Redrose64 (talk) 15:52, 2 April 2013 (UTC)
Brilliant, I would never have thought of it being something like that. Thank you very much. Legendary. Mmitchell10 (talk) 18:34, 2 April 2013 (UTC)

page section

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)

No, the list at Help:Magic words#Conditional expressions is the complete list as far as I know. -- John of Reading (talk) 16:16, 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}}

Please see request at Template talk:ShortcutLittleBen (talk) 13:53, 28 April 2013 (UTC)

Counting items in numbered list

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.com Technical 13 (talk) 00:58, 9 May 2013 (UTC)
Please see my response at Wikipedia talk:WikiProject Templates#Counting items in numbered list. --Redrose64 (talk) 07:23, 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)
Please don't use </br>, it's not valid markup. Use either <br> or <br /> --Redrose64 (talk) 20:16, 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:

So, what would your ul look like? Technical 13 (talk) 20:12, 13 May 2013 (UTC)

Yes, the ul would look like what you have shown. But I don't see the relevance here. Chaipau (talk) 20:18, 13 May 2013 (UTC)
I'm asking you to type out the ul for the chart you want to make... Technical 13 (talk) 20:49, 13 May 2013 (UTC)
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, Number 57 11:05, 17 May 2013 (UTC)

Poor formatting gone. I'm wondering if a placeholder map should be there instead though. Technical 13 (talk) 12:07, 17 May 2013 (UTC)
Thanks. I don't think so, as many will never get made. Number 57 12:26, 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)
The use of image placeholders has been deprecated for some years now. --Redrose64 (talk) 12:43, 17 May 2013 (UTC)
I know I picked the wrong word, please see Template talk:Infobox referendum#Accessibility for clarification. Technical 13 (talk) 13:40, 17 May 2013 (UTC)

Template:SharedArms

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)

I've fixed up the display of the template page. -- John of Reading (talk) 19:48, 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)

  Fixed, see here If a template such as {{cite journal}} is inside <ref>...</ref> it cannot see parameters passed to the enclosing template. The technique to use is the {{#tag:ref}} parser function. --Redrose64 (talk) 13:34, 20 August 2013 (UTC)
Or {{refn}} or one of the variants. --  Gadget850 talk 19:22, 20 August 2013 (UTC)
Thanks for your assistance. It works great. Themeparkgc  Talk  22:27, 20 August 2013 (UTC)

param displaying pipe 2 ways

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)))

Need help setting up as sec

Arkansas Union Regiments
Previous Next

— Preceding unsigned comment added by Damon.cluck (talkcontribs) 21:47, 10 September 2013‎

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)

URL linked with next word

If a parameter value is a URL ending with either an equals sign or a template that generates an equals sign ("=" or "{{=}}", respectively, without quotation marks), the displayed result is of a linked URL that extends the link to include the next word in the displayed result, beyond the URL, making following the link difficult except for us geeks perceiving the error. Examples are visible of the overextended link despite ending with "{{=}}" and the proper link even though the value has subsequent text and the proper link even though the value has a subsequent space template (I assume a plain space there would get stripped) and are based on the template draft. By contrast, another template has no such problem. Nick Levinson (talk) 21:17, 25 August 2013 (UTC)

Replied at Wikipedia:Help desk#URL from draft template linked with next word. PrimeHunter (talk) 21:17, 14 September 2013 (UTC)

Lua Language

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)

You could start off at WP:LUA, but I'm highly doubtful that it's possible. --Redrose64 (talk) 18:46, 11 October 2013 (UTC)

Question re templates

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

| rounds = | candidate1 = | party1 = | votesroundone1 = | percentroundone1 = | votesroundtwo1 = | percentroundtwo1 =

Is this possible, or would two separate templates for one and two-round elections be needed? Cheers, Number 57 22:21, 1 December 2013 (UTC)

Track Listing Tables

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.
Why do you need another column besides those that are provided? --Redrose64 (talk) 14:57, 2 December 2013 (UTC)
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:
| title1          = 
| note1           = 
| writer1         = 
| lyrics1         = 
| music1          = 
| extra1          = 
| length1         = 
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:
No.TitleLyricsMusicExtraLength
1."A Good Example" (Produced by John Doe)Jane DoeJohn DoeExtra79:59
Before anything is changed, a note should be left at Template talk:Track listing, and WT:ALBUMS should be notified. --Redrose64 (talk) 20:07, 2 December 2013 (UTC)
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)