Help talk:Template/Archive 3
From Wikipedia, the free encyclopedia
| 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. |
| 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)
- 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
- Obviously not by creating a redirect, that didn't work. Help? --AW (talk) 20:34, 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)
- 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)
- The same thing happens when I do this:
- Why does this not work?
- 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)
- 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)
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)
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 "ifwikisourceis present (regardless of whether it has a value or not), use{{{wikisource}}}; ifwikisourceis 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)
- 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:
- 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:
- 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)
- OK got it now! By modifying the second template (test2) to :
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)
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?
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)
- Fine; I was considering
- I have boldly replaced it with {{lambda}}.--Fuhghettaboutit (talk) 22:13, 13 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:
- 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)
- Thanks for the responses! Two templates:
{{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 (talk • contribs) 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
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)
- "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)
- 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 (talk • contribs) 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 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)
- That edit is a step in the right direction but I want to see the info at preloaded into the edit. -- Alan Liefting (talk - contribs) 18:31, 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
|#defaultin 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)
- 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)
- Correct. -- Technical 13 (talk) 22:12, 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)
- 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)
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)
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=Narniainstead of|name=Narnia charactersin 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
nameparameters 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)
- Yes. Template:Navbox#Setup parameters explains it. I have fixed many wrong
- You are quite correct: if a navbox (or any other template containing v-t-e links) is moved, the
- 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)
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)
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)
- 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)
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)