Help talk:Template

From Wikipedia, the free encyclopedia
Jump to: navigation, search
the Wikipedia Help Project (Rated C-class, High-importance)
WikiProject icon This page is within the scope of the Wikipedia Help Project, a collaborative effort to improve Wikipedia's help documentation for readers and contributors. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks. To browse help related resources see the Help Menu or Help Directory. Or ask for help on your talk page and a volunteer will visit you there.
C-Class article C  This page does not require a rating on the project's quality scale.
 High  This page has been rated as High-importance on the project's importance scale.
WikiProject Templates
WikiProject icon This page is within the scope of WikiProject Templates, a group dedicated to improving the maintenance of Wikipedia's templates. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.

Problem with if scripts[edit]

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

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

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

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

Template naming conventions[edit]

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

If then else[edit]

Can anybody explain how to set the function of a parameters as either Yes or No. And that does a specific task when set yes and another specific task when said no? And how to set the default as yes?
aGastya  ✉ Dicere Aliquid :) 15:08, 29 April 2015 (UTC)

@Acagastya: Not sure what you mean, but we do have {{yesno}} --Redrose64 (talk) 16:46, 29 April 2015 (UTC)
@Redrose64:Okay Let me use it. If any problem, I will ask.
aGastya  ✉ Dicere Aliquid :) 17:04, 29 April 2015 (UTC)

Re-sectioned material[edit]

Recently we've been communicating through edit summaries. Please see them. But I must now try to put to rest any concerns about what's going on.

Section Syntax was short, like a man page, which I liked, but found lacking in what I considered critical syntax. That's how it started. After adding the missing syntax, I studied the entire page carefully. I noticed the "missing" information in a long bullet list. I also noting a main section Creating and editing. I then noticed a second bullet list, and a section titled Other details, all three exhibiting a mixture of Template Usage and Template Creating. So I took the three and distributed their content best I could between Using templates and Creating and editing templates. This grew the little Syntax section.

Syntax was renamed Using templates, and other sections had all their content moved all over the page, or were renamed or newly added. That made this page into a draft quality page. I feel it is a fine reorganization, but that it entails going through section by section to copy edit and integrate content that was more or less cut and paste there. — CpiralCpiral 23:58, 28 July 2015 (UTC)

@Cpiral: I worry that your edits have made the page harder to understand for people new to templates on Wikipedia. This page should be as simple as possible to help people understand the concepts involved - diving into complicated examples and terminology straight away is going to confuse people. If anything, the page needs to be simpler than it was before. — Mr. Stradivarius ♪ talk ♪ 04:49, 29 July 2015 (UTC)
I'd like nothing more than the honor of meeting your simplicity and introductory-level requirements. It saddens me to have to ruffle feathers of those whose names I've grown to respect.
I'm fairly new to template editing, and have fresh memories of how things seemed on the way up. Please give me a few days to get this page in shape. If you have any doubts, most of Help:Searching and Help:Pagename and WP:Pagename are my old works, {{val}} is recent, but {{tlusage}} and {{regex}} and {{search link}}are still in draft mode (until I get Help:Searching/Draft to share their new CirrusSearch parts).
Please let me worry for you for a little while. Thank you for your feedback. — CpiralCpiral 05:40, 29 July 2015 (UTC)
If you are fairly new to template editing, that really does suggest that you are perhaps not the best person to rewrite the help page. It should be written by those with a thorough understanding of how templates work (like me) but who also have experience in writing educational materials (not like me). If I, as an experienced template coder, have difficulty understanding your changes, how must a newbie feel? I notice that you reverted Mr. Stradivarius - this is not how WP:BRD works. You were bold in making your edits; Mr. Stradivarius (talk · contribs) reverted you, then we should get discussion - not further B/R. --Redrose64 (talk) 09:58, 29 July 2015 (UTC)
One plan might be to keep things fairly simple here, and move the advanced stuff to Wikipedia:Advanced template coding, and wiki-link if necessary. While the changes of Cpiral do make things more comprehensive they also make it more complex, and this complexity is perhaps better on another page. Templates are difficult for most, and need something simpler perhaps, at least to start with. --Jules (Mrjulesd) 11:45, 29 July 2015 (UTC)
(edit conflict) Well, I suppose I am a teacher in real life, so I probably fulfil the "writing educational materials" requirement. I also have a basic idea of how I think the page should go. But before we go about rewriting this, I wonder whether it might be better just to convert it into an index page. We already have mw:Help:Templates, which is quite well-written in my opinion, and there are several other template help pages around. Rather than having separate template help pages on several different wikis, how about just linking to one central one and making that one as good as possible? If there are things that only apply to this wiki we can add them to another help page here rather than clutter up the central page. — Mr. Stradivarius ♪ talk ♪ 11:49, 29 July 2015 (UTC)
I would like to restore the June 9 version of Help:Template. The Geek gradient dooms a proper Help page. — CpiralCpiral 20:16, 29 July 2015 (UTC)
I propose we put the current material at WP:Template. Wikipedia has a history of improving the Help namespace MediaWiki ships with. A thorough investigation of Wikipedia's history of moving the Help pages given by MediaWiki to more advanced Project versions should help assess my proposal. Transferring the history and attributions would require an import/export? — CpiralCpiral 20:16, 29 July 2015 (UTC)
The only bit of that which I understood was "I would like to restore the June 9 version of Help:Template", and I agree with the proposal. But if that is what you want, why did you revert Mr. Stradivarius? Their edit did restore the 9 June version. --Redrose64 (talk) 20:48, 29 July 2015 (UTC)
It has to do protocol, which I believe has to do with encouraging myself to edit. Thanks for the feedback, Redrose. I need some help in understanding it myself: In order to fork Help:Template to the new title Wikipedia:Template, as I propose, we'd need to delete the redirect WP:Template --> Help:Template, and then export Help:Template and then import it to WP:Template, all in order to preserve the history of contributions, right? — CpiralCpiral 21:58, 29 July 2015 (UTC)
I think that you're trying to complicate things unnecessarily. Just revert the whole page to how it was on 9 July, then leave it at that. --Redrose64 (talk) 23:01, 29 July 2015 (UTC)
Done already. — CpiralCpiral 23:35, 29 July 2015 (UTC)


If there is any onlyinclude tag, it should appear only once. Also there should be no includeonly or noinclude tags anywhere else. GeoffreyT2000 (talk) 16:30, 5 August 2015 (UTC)

Why only once? --Redrose64 (talk) 20:49, 5 August 2015 (UTC)
Ya can't go by the sounds of the names. "Yet another onlyinclude" is valid. Now, because these onlyincludes exclude what's outside of the them, while noincludes exclude what's inside them, when using multiple onlyinclude tags you don't need noincludes outside of them; however you need them inside to show "documentation only", and you need includeonly for the same reason inside of them, but to hide template code from that same documentation (when documenting from inside the template instead of using {{documentation}} exclusively.) It's a complete system with names that make make sense only in terms of the other names. — CpiralCpiral 22:21, 5 August 2015 (UTC)
You should get rid of the noinclude tags outside the onlyinclude tags, but not the text between them. Also, you should either get rid of both the includeonly tags outside the onlyinclude tags and the text between them, or replace <includeonly> with <!-- and </includeonly> with --> outside the onlyinclude tags. GeoffreyT2000 (talk) 22:44, 11 August 2015 (UTC)

HTML comments and noinclude/includeonly[edit]

Is <includeonly><!--</includeonly>text<includeonly>--></includeonly> equivalent to <noinclude>text</noinclude>? Similarly, is <noinclude><!--</noinclude>text<noinclude>--></noinclude> equivalent to <includeonly>text</includeonly>? GeoffreyT2000 (talk) 00:21, 12 August 2015 (UTC)


template:Identity, a utility template for template safety, is up for deletion -- (talk) 05:29, 1 September 2015 (UTC)

Trying to make a Mars time template in my sandbox...[edit]

Link is here, with all info: User:MSJapan/Marstime.

Short version: I was asked for help to make a template to do a running clock for articles on Mars. Mars actually has timezones, but the offset from UTC is not a round number. Therefore, the end result should be from the now template, but adjusted for UTC - 2:02:21, and a different timezone listing. I therefore figured I had to adjust the currenttime template to address that, but it's not playing nicely with fractional offset. Can someone help? MSJapan (talk) 00:44, 4 September 2015 (UTC)

Error in the NIE template[edit]

The following mistake results in a widely propagated inaccuracy to an out-of-copyright citation at Wikipedia.If it can be fixed, the correction will propagate widely, and result in improved information accuracy in the encyclopedia.

The template:

 This article incorporates text from a publication now in the public domainGilman, D. C.; Thurston, H. T.; Colby, F. M., eds. (1905). "article name needed". New International Encyclopedia (1st ed.). New York: Dodd, Mead. 

should reflect the fact that the editors of this first edition were: Daniel Coit Gilman, Harry Thurston Peck, and Frank Moore Colby (see Template:New_International_Encyclopedia).

Instead, it presents the the third editor as "F. Moore" (presenting the middle name, omitting the surname).

Please, indicate here how this might be fixed (or, if easily done, execute the correction yourselves)? Cheers. Le Prof Leprof 7272 (talk) 16:18, 12 September 2015 (UTC)

@Leprof 7272: Have you taken this up at Template talk:NIE? --Redrose64 (talk) 20:20, 12 September 2015 (UTC)

Constructing a URL from template parameters[edit]

Following a change to a government web site, the Template:cite QPN needs to be updated. The main problem relates to the new URL format to be constructed from the two main parameters, a place name and a reference number. My current version in the Template:Cite QPN/sandbox works fine if the place name involved is a single word e.g. "Kenmore", but if it's a multiple word place name like "Kenmore Hills", it doesn't work. The URL I correctly generate for Kenmore is:

but for Kenmore Hills I need it to be:

That is, in one place, I must replace the space between Kenmore and Hills with a %20 and in the other place with an underscore. How do I do that? (Note some place names might have 3 or more words separated by spaces).

I have tried using urlencode and replace but could not get them to work for me (I have never used them before). Thanks for any advice anyone can offer? Kerry (talk) 02:36, 13 September 2015 (UTC)

@Kerry Raymond: urlencode has a couple of options that you could try; see Help:Magic words#Paths - {{urlencode:Kenmore Hills|PATH}} -> Kenmore%20Hills and {{urlencode:Kenmore Hills|WIKI}} -> Kenmore_Hills. -- John of Reading (talk) 04:18, 13 September 2015 (UTC)

Onlyinclude in nowiki[edit]

On mw:Transclusion, it says Note that unlike <noinclude> and <includeonly>, <onlyinclude> will take precedence over enclosing <nowiki> tags. In other words, <nowiki><onlyinclude>My content</onlyinclude></nowiki> produces only "My content" when transcluded.. However, in fact this is not true – onlyinclude tags within nowiki tags are treated like any other text inside nowiki tags. GeoffreyT2000 (talk) 18:45, 29 September 2015 (UTC)

The quote from mw:Transclusion is about transclusion behaviour and is correct. Transclusion of User:PrimeHunter/sandbox3 produces:
My content
"Before" and "After" are not transcluded so <onlyinclude>...</onlyinclude> works inside <nowiki>...</nowiki>. On the page itself it's treated like other tags but not when it's transcluded. PrimeHunter (talk) 19:59, 29 September 2015 (UTC)