Help talk:Templates

From MediaWiki.org

Jump to: navigation, search

Note: This page is for discussion of the Help:Templates page only. General software questions or requests for help should be posted on the Support Desk.

Examples of each usage would be extremely helpful - Will the WikiWise please provide some? Thanks! —The preceding unsigned comment was added by 24.108.13.171 (talkcontribs) 23:04, 25 November 2006.

Contents

[edit] Namespaces

Should the fact that any page can be used as a template be mentioned, or should it remain undocumented magic? -- Duesentrieb 16:35, 16 January 2007 (UTC)
I did see that mentioned someplace just a second ago. Martin | talkcontribs 22:13, 22 February 2007 (UTC)

[edit] Confused

Ok I cant seem to work out how this thing works at all, I try and copy and paste the code here and it dont work. what am i doing wrong?

{{Object
|name=
|image=
|filename=
|Developer=
|Latest=
|Release=
|License=
}}

Thats what I put for a test template and all i get is the title come up Object

Any ideas

[edit] Re:Confused

Templates works only as transformation. In your wiki you have to create Template:Object page if you want to use template named Object, try something more simple as first template.

I think this help is well understandable. Maybe another example will be good for you.

In your wiki edit page www.yourdomain.com/wiki/Template:first
Write there something like:

 Your first argument:<b>{{{1}}}</b><br>
 Your second argument:<i>{{{2}}}</i>

save the page (stop editing)

somewhere in your wiki edit some another page and insert here code:

{{first|1=text1|2=text2}}

It was not working without 1= and 2= for me in wiki 1.9.3 (bug)

when you try preview now, you will see:
Your first argument:text1
Your second argument:text2

I hope it's clear now, {{{1}}} from template page will be replaced with everything what is after 1=

--Betlista 17:53, 17 May 2007 (UTC)

[edit] Templates with/for images

How would I create a template where I pass only the name of an image (e.g. 'picture01.png'), and within the template this name is transformed into something like

[[Image:picture01.png|150px|]]

?

Going one step further, I want to do it the 'Semantic MediaWiki' way, ie. again pass only the name of the image, and the template does the rest, ie.

  • assign the parameter (
    [[ImageName:={{{ImageName|}}}]]
    
    )
  • expand this to
    [[Image:[[ImageName:={{{ImageName|}}}]]|150px|]]
    

Unfortunately like this it doesn't work. 85.125.230.177 15:53, 13 June 2007 (UTC)

[edit] Templates inside parameters

At my wiki I have a template called Shape and a template called R strange. The original intention was to put {{R strange}} inside the Shape template, but writing {{Shape|{{R strange}}Name of shape|other parameters}} doesn't work, rather it makes it be interpreted as {{Shape|other parameters}}. Is there any way to nest templates like this?

If not, I'll likely have to do some crazy positioning stuff with CSS.

- Keiji 82.32.169.78 16:37, 18 June 2007 (UTC)

Never mind, I got it to work.

- Keiji 82.32.169.78 16:57, 18 June 2007 (UTC)

How??? Slamlander 05:31, 25 October 2007 (UTC)

[edit] Some help?

Can anyone explain to me why this code produces bold text? I can't figure it out. Thanks in advance.

{|style="width: 99%; border: solid #000000; text-align=center;"
|-
! style="background:#CCCCCC;" | This article or section is currently empty, but the author intends to fill it in at a later time.  It should not be deleted.
|}

--67.84.103.128 00:38, 24 June 2007 (UTC)

It's because of the "!" at the beginning of that line. Replace it with "|" and you'll be happy ;-)
In addition you have to replace the "=" within "text-align=center" with ":" – otherwise it won't have any effect. --:Bdk: 01:03, 24 June 2007 (UTC)
Thanks a lot for the help, but why is it that a ! instead of a | makes it bold? --67.84.103.128 01:15, 24 June 2007 (UTC)
See Help:Tables. --:Bdk: 01:42, 24 June 2007 (UTC)
Thanks again. Not sure what the rules are on this particular wiki about deleting, so I don't want to delete this topic myself, but I go the info I needed. --67.84.103.128 02:02, 24 June 2007 (UTC)

[edit] Default templates?

Is it possible to create a template that is instantiated automatically without the user's intervention?

I've got a family wiki that many people edit. I'd like pages created from one particular page to all automatically start with a template. It's a collection of recipes. The procedure is to add the name to that page. When they link to the new page, I'd like it to automatically start with a default recipe format...

Thanks! (twinotter) 165.219.245.62 19:12, 10 July 2007 (UTC)

That goes beyond templates and into boilerplates, or parameterized templates. Using templates this way actually makes your pages harder for your users to edit. At that point, you might be better off with a specialized PHP page. My recommendation is to do a standard page header template and show your users how to use it. -Slamlander 05:23, 25 October 2007 (UTC)

[edit] Quick installer, perhaps?

If one were to install MediaWiki on their server, is there a chance there's an installer that comes with a bunch of templates? If so, a link to such a program would be nice. - Ahren 1:46 EST

[edit] Optional Fields?

As my question pertains to template use, I suppose this is where it goes. Is there a code for optional fields in a template? For example (Code I use is below): Say I want it set so that rank does not appear, if the field is not filled in, how does one do that? Thanks for any help someone can give.

{| align="right" border="1"
|-
| colspan="2" align="center" | '''{{{name}}}'''<br/>[[Image:{{{image1name}}}|{{{image1size}}}px]]
|-
| '''Name:'''
| {{{name}}}
|-
| '''Affiliation:'''
| {{{affiliation}}}
|-
| '''Rank:'''
| {{{rank}}}
|-
| '''Homeworld:'''
| {{{homeworld}}}
|-
| '''Species:'''
| {{{species}}}
|-
| '''Gender:'''
| {{{gender}}}
|-
| '''Date of Birth:'''
| {{{dateofbirth}}}
|-
| '''Age:'''
| {{{age}}}
|-
| '''Height:'''
| {{{height}}}
|-
| '''Weight:'''
| {{{weight}}}
|-
| '''Status:'''
| {{{status}}} <small>({{{statusyear}}})</small>
|}

--TheSisko 22:28, 19 August 2007 (UTC)

First, make sure you have the parser functions [[1]] installed and working. Then you can do the following;

|-
| '''Rank:'''
| {{#if:{{{rank|}}} | {{{rank}}} }}
|-

Give that a try and let us know if you got it working =)

Thank you for mentioning this ParserFunctions extension, a lot of wasted time until I found that, thanks!

[edit] Infobox class??

I've just installed my first wiki - 1.10.1 and trying to setup some Infobox templates. The problem is there seems to be no Infobox class defined anymore? The various files I find online that have it, such as monobook.css and common.css seem to be competely different to the css files in the 1.10.1 package. I'm guessing something has changed quite dramatically in recent versions? What am I missing? --DJS68 02:09, 1 September 2007 (UTC)

I'm not a PHP programmer, but this line doesn't look right in monobook.php -
<style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?<?php echo $GLOBALS['wgStyleVersion'] ?>"; /*]]>*/</style>
--DJS68 02:29, 1 September 2007 (UTC)
nope that's not the problem :-( --DJS68 02:37, 1 September 2007 (UTC)

[edit] Templates Outside the Template Namespace

I just felt like sharing this:

  • Any page that has data in it can be used as if it were a template. Just enclose the page title in double curlies like so:
This would import expand this page into on whatever page you were editing.
{{Help_talk:Templates}}
  • A special addition needs to be made if you are trying to use a page from the "(Main)" namespace since a call to:
{{Main_page}}
is equivalent to a call to:
{{Template:Main_page}}
If the page you want to use as a template is in the "(Main)" namespace, you must precede the page name with a colon (:) like this:
{{:Main_page}}

My apologies if this has already been discussed elsewhere. --Egingell (talk) 20:58, 2 September 2007 (UTC)

[edit] Template Migration

I have a number of wiki's that I maintain and I want the same templates on all of them. How do I replicate the whole batch (about 36 of them) in one go?

- Slamlander 05:37, 25 October 2007 (UTC)
Use Special:Export and Special:Import. Or you could try remote transclusion. Jlerner 18:45, 16 November 2007 (UTC)

[edit] Templates Args

Any best practices advice or example for dealing with unnamed template parameters? And possibly mixed ones? I would like to be able to write a template like this the following. And easily access the unnamed parameters. Using the variable and control structure extensions to for/while loop through the {{{ {{#var:{{i}} }} }}}} to manufacture a "argv[]/argc" was the best I can come up with, but it seems to be a pretty intensive.

{{mytemplate|namedParam=1
|unnamedOne
|unnamedTwo
|unanmedThree
|...
}}

Thanks --Gmillerd 10:44, 26 November 2007 (UTC)

[edit] Template Overload

Hi there, I have got a question: We have some templates which we use A LOT, even A LOT on one single page. It has an ID as parameter and outputs an icon + a text. The software stops converting the templates at some point and this is kinda anoying. anyone with ideas for that? or can we change the "max templates"-value? maybe someone could even add this pint to the article. greets, 79.193.229.90 15:28, 24 January 2008 (UTC)

[edit] How do the Wikipedia Template: Cite book and Template: Cite work?

I'd like this in conjunction with my wiki page... but currently I can't figure out the implementation.--66.214.128.163 17:08, 2 February 2008 (UTC)


Hmmm wikipedia:Template:Cite and wikipedia:Template:Cite book hey? Use the 'view source' tab to see their wiki text.
You should just be able to create a page called "Template:cite" on your own wiki and put in the follow wikitext:
<span id="{{{ref}}}" name="{{{ref}}}" class="citation">{{{author}}}, ''{{{title}}}'', [[{{{publisher}}}]], [[{{{date}}}]].</span>
...to get a similar effect. I've missed of the 'noinclude' documentation section which is not necessary, and makes it more complicated. (it uses another template "wikipedia:Template:Documentation" to transclude documentation from a sub-page)
Now the 'Cite book' template is more tricky. I think it's using a parser extension. Probably Extension:Cite/Special:Cite.php, which you would have to install on your wiki, if you wanted it to work in exactly the same way. You can probably think of a more simplistic way of acheiving what you need though.
Templates on wikipedia tend to be rather more complicated than they need to be, and certainly not designed to make it easy to copy them. I was thinking actually we could kick off a project similar to Project:PD help, but for supplying a simple bunch of standard tempates for a new wiki installation.
-- Harry Wood 11:15, 4 February 2008 (UTC)

[edit] [RESOLVED] Missing parameter

Let's say i define 2 parameters. When only 1 is called it will display {{{param2}}}. Is there a way to let it fall back to and call {{{param1}}} in such cases? --Subfader 20:04, 29 February 2008 (UTC)

{{#if:{{{param2|}}}|{{{param2}}}|{{{param1}}}}}
--Egingell 16:44, 1 March 2008 (UTC)
Ok how to add it? I have the template: [[Media:{{{1}}}|{{{2}}}]]. Now without a defined param2 it should work like this: [[Media:{{{1}}}|{{{1}}}]]. --Subfader 09:57, 28 March 2008 (UTC)
Got it now! Thanks. --Subfader 18:31, 10 April 2008 (UTC)

[edit] A parameter starting with a single "+" sign is not processed as expected

I wrote a template where a parameter holds a telephone number (its content looks like "+123 (456) 78901234"). If I type something like this:

{{TemplateName
|Phone=+123 (456) 78901234
}}

It's not processed correctly and the value is displayed on the wrong position. If I type something like this:

{{TemplateName
|Phone='+123 (456) 78901234'
}}

The phone number is displayed the right way, but has the sorrounding quotes. How do I pass a parameter starting with a "+" sign to a template? Thanks --Major² 10:08, 31 March 2008 (UTC)

Please tell us what the template definition looks like -- Duesentrieb 12:30, 31 March 2008 (UTC)
This is a really simple template used to display business card info within a table:
{|cellspacing="1"
|-
! colspan="2" style="text-align: center; color:#4b4b4b; background:#E2F0E8;" | {{{Name|{{PAGENAME}} }}}
|-
! align="right"|Address
|{{{Address}}}<br />{{{ZIP}}} {{{City}}} ({{{State}}})<br />{{{Country}}}
|- style="vertical-align: top;"
! align="right"|Phone
|{{{Phone}}}
|}
––Major² 23:59, 31 March 2008 (UTC)

[edit] [RESOLVED] replace paramter if ...

Parameters: I use [[:File:{{{1}}}|(desc)]] to create a link to desc page of {{{1}}} which is the file name. Now sometimes it can happen that this parameter is an external link. In this case the desc link shouldn't show up. I dunno much about #if so is there a way to e.g. if param1 = http... then "(desc)" = "-" or something? --Subfader 15:17, 6 April 2008 (UTC)

[edit] Included Titles Cannot Be Edited by Subsection

A template that includes a title cannot be later edited by subsection. The problem is, once the information is filled in and saved, if you want to edit that subsection, the EDIT link goes to the Template structure instead of the content. Is there a way to avoid this? Template example follows:

=== {{{Title}}} ===
* '''Members''': {{{Members}}}
* '''Topic''': {{{Topic}}}
* '''Responses''': {{{Responses}}}

The majority of our users are non-coders and will likely not be able to figure out that they need to use the Page edit link (at the top of the page) instead. Ideas? Samspectre 18:21, 30 April 2008 (UTC)

Yeah. This isn't really a bug of the software because in many uses of templates, the behaviour (to edit the section within the included template) is the most logical/user friendly thing to do. Say for example you set up a single template which you bring in to your 'Home Page', and that template contains section headings and all the text content, the user expects to edit the text contents, therefor they need to be editing the section within the template.
I see your problem though. Because you're passing in text content in parameters from the including page.
Some things which don't really solve the problem, but in case you're not aware:
You can switch off the [edit] links using the __NOEDITSECTION__ magic word.
You could disable edit link of a particular section by making it not a real heading, so instead of === {{{Title}}} === just do something like <font size=+1>'''{{{Title}}}'''</font>
You could leave an explanatory note to be seen by anyone editing template definition, using HTML comments. Something like: * '''Members''': {{{Members}}} <!-- text passed in via the 'Members' parameter from the page which includes this template -->
I appreciate non of these things offer an ideal solution for you. Anyone else have suggestions?
-- Harry Wood 10:11, 1 May 2008 (UTC)
No, unfortunately not. But I have exactly the same problem.--Gollum 16:09, 15 May 2008 (UTC)
Everybody has this "problem". It is a limitation of using templates. There is no practical way, other than to use the suggestions above, to avoid this. There *might* be a way to tell the software that you're editing templated content, but I think it would generate unecessary server and database strain. I, personally, use the __NOEDITSECTION__ method to prevent the [edit] links from showing up at all. It doesn't matter where you put it, I put it in the template page itself. --Egingell 05:00, 16 May 2008 (UTC)

[edit] Choosing between templates on the same page

We are working on a Wiki for product information. Each product page holds a (long) list of parameters on that specific product. Now we would like to create multiple templates that display these parameters in different ways concerning their order, selection and format. the user should be able to choose between different display styles, while the editors just have to work on one page, which holds all information. Is there any possible way to do so? My best, --Gollum 16:19, 15 May 2008 (UTC)


Did you ever happen to solve this problem? I am looking to accomplish the same thing!

[edit] input tag filled with a template value

Hi,

Is there any way to display input tag filled with template values within a page?

Example:

<td>
[[Delivery::{{{Delivery|}}}]]
<html><input type="checkbox" checked="[[Delivery::{{{Delivery|}}}]]" disabled></html>
</td>

"Delivery" has value "False". In the page should now appear an unchecked checkbox. The checkbox is checked because the placeholder Delivery:: has not been replaced by the template engine. The html source code is:

<td>
False
<input type="checkbox" checked="[[Delivery::{{{Delivery|}}}]]" disabled>
</td>

I suppose thats through the "<html>" tags that I used in order to display the input box as html control (and not as plain text).

Thx for suggestions. kati

[edit] Templates inside parameters

Hi, I'd like in my wiki a structure like:

 {{detailedDescription
 |detailedDescription={{stub}} ... text of the description}}

In other words to use use a template as parameter of another template call.

The problem is that the interpreter reads the first closed curly brakets as closure of the template call, so it passes to template:detailedDescription only '{{stub'.

How can I make template:detailedDescription to accept the complete text and to show the content of template:stub in the final page?

Thank you,

--Dongiulio 14:24, 29 October 2008 (UTC)

[edit] Special characters as template parameters

Hi, I'm trying to write a template in wikibooks (MediaWiki 1.14alpha — r44990) which needs to accept "special characters" as parameters, like: '*', ';', '='... (see delimiters list). I'm trying something like this (see template:Ada/delimiter):

 [[Ada Programming/Delimiters/{{ #switch: {{{1|}}}
  |.=dot
  |..=double dot
  |&#124;=vertical line
  |&#61;>=arrow
  |>&#61;=greater than or equal to
  |<&#61;=less than or equal to
  |#default = {{{1}}}
 }}|{{{1}}}]]

However, some invocations work (e.g. with &, ', +...), but others don't (e.g. *, ;, :...). In the cases that don't work directly, sometimes it works using the HTML entity (e.g. &#42; for *), sometimes when using the named parameter ({{Ada/delimiter|1=/=}} for '/=' delimiter). Can I write something in the switch for not havin to use the HTML entity or the named parameter? Thanks! —surueña 23:03, 29 December 2008 (UTC)

Done, I've just to remove the default case. Of course, for those delimiters containing a '=' named parameter should be used ({{Ada/delimiter|1=/=}} for '/=' delimiter), and the html number (&#124;) should be used for the | character (or the {{!}} template). But, does the need to remove the default case for the '*', ';'... parameters can be considered a bug? Thanks! —surueña 12:34, 30 December 2008 (UTC)
Arrg, it doesn't work yet! The problem is that the switch returns void for several values, including when the text contains a '='. I read it in the documentation this behavior of #switch:, any plan to allow it when using an html number entity? Thanks —surueña 12:54, 30 December 2008 (UTC)
What does the pipe symbol do? I see some logic using {{{1}}} and some using {{{1|}}} (the latter one has an extra "|" in it). But I can't seem to find any manual page which explains the reason for the symbol. Does anyone know? --Elonka 21:50, 3 February 2009 (UTC)

[edit] Unknown Number of Variables beforehand

Hello. I am trying to create a template but I don't know the number of variable a priori. I want to allow editors to add any number of items in a list but I don't know the number beforehand. Is this possible? How do I do it?

Thanks.

[edit] Heading level and templates

How can I make a template where the heading level matches the page it is included on? For example, if the template is included under a level 1 heading, headings on the template would be level 2. If it was included under a level 2 heading, the headings on the template would be level 3.

[edit] Remove braced variables from article?

Is it possible, in a way other than removing the variable from the article, to remove the triple-braced template variable from articles when the variable has not been specified?

I assume you mean that when, say, the second parameter isn't supplied, you'd rather not have {{{2}}} displayed in the article that included the template. Correct? If so, just give the parameter an empty default value in the template. Use {{{2|}}} rather than {{{2}}} when referencing the parameter in the template. --Vjg 16:03, 9 March 2009 (UTC)
Yes, that is exactly what I meant... and that is exactly the workaround I came up with eventually... I just wish there was a permanent solution. Thanks though!!! --Bsmithme 21:50, 9 March 2009 (UTC)

[edit] Documentation Page

Where do you place the Documentation Page? namespace:Template:Info Box xxx

Thank You stnick @ wikiwood [2]

[edit] Blank Default Parameters

This seems like a simple question but from all my googling I can't figure out an answer. How can I give a named parameter an empty default value, so that if someone using my template does not fill in every parameter, the undefined parameters simply don't show up?

Example: In my template there is a named parameter, [[{{{Subcategory 1}}}]], which creates a link to an internal page named Subcategory (or whatever is defined by the template user). Right now, if no subcategory is defined, [[]] shows up on the page. How can I make it so that nothing shows up if the Subcategory 1 parameter is left undefined?

I appreciate any help, have pity on a Mediawiki newbie!

-Michelle

Use {{{Subcategory 1|}}} (notice the pipe character after the "1"). INVERTED 20:41, 25 July 2009 (UTC)

[edit] Wiki equals HTML

This is an example of an wiki format {{Example}}. It is a template. Lets say it has news updated on it and it changes on every page the template is added on. What would this simple wiki format be if it was in HTML? I want to use it on my HTML website and want it to be updated automatically when I change it on my wiki. Sachein 14:52, 12 May 2009 (UTC)

You can't use template wikicode as HTML... if you wanted to do that, you'd need to do some rather complicated PHP. INVERTED 20:39, 25 July 2009 (UTC)

[edit] Calling a Teplate on every Site

If I want a Template to display on every site what should I do?

Nobody has an idea how to display a template on every site? maybe some monobook modification?

[edit] Unclear behavior of template substitution

I found out the hard way tonight that pages in the main namespace need two colons when using template substitution as in: {{subst::Page Name}}. I guess this is the logical product of adding subst: to {{:Page Name}}, but its not immediatly obvious and might be worth explicitly stating.--66.92.234.13 04:33, 8 June 2009 (UTC)

[edit] A simple "how to" or tutorial section

I would like to suggest a simple "how to" or tutorial section. After reading this page I still have no idea how to create a template. Thanks

[edit] Template with large parameter causing MediaWiki crash

When I try to put a large parameter inside a template (six or so paragraphs), MediaWiki decides to send a blank response to the browser. Also, I tried splitting the text up to several parameters, but it seems that the total size of the parameters is what matters. Please fix this! INVERTED 17:32, 25 July 2009 (UTC)

[edit] I Am UTTERLY Thick

Even with all the excellent documentation I have not been able to make the TOClimit template work on my site. I have tried over and over again, but nothing has worked yet. I am sure the problem is not with a lack of instructions but rather my utter lack of intelligence. Can someone please distil down the knowledge about how to implement templates so that it can be understood by a large brassica (hey! this suggests I can't even spell brassica correctly - I must be a cabbage).

Anyhow, I am making a plea for very clear, straight forward, instructions on how to get the TOClimit template to work. I am wanting to implement a Quality Manual documentation project, which has numerous headings but should only display them down to a limited level.

Hey, I am thick too :) - perhaps you can have a look if it is referencing any CSS or javascript - if your site does not have this, then it might not work. --Boy.pockets 01:59, 8 October 2009 (UTC)

[edit] Cheadings and other Special Characters passed in as a template param

I want to be able to pass in a special character as the first item in a template parameter, but it does not seem to work. Something like this.

{{Thankyou
|reason=*all your hard work and
*great looks
|signature=Joe}} 


Example sunflower image
A little thank you...
for *all your hard work and
  • great looks.
    hugs, Joe

Of course, I could add a
in front, but I don't want to do that. Is there anything I can do in the template to allow me to do that?--Boy.pockets 01:59, 8 October 2009 (UTC)

  • I have the same problem. I cannot seem to google up a solution. Any progres with this? --Rob
    • Insert a new line in the template just before the parameter may be helpful. The template is changed from:
for {{{reason|{{{1}}}}}}.
to
for
{{{reason|{{{1}}}}}}.
and allows the asterisk to be correctly interpreted:
Example sunflower image
A little thank you...
for
  • all your hard work and
  • great looks.
    hugs, Joe
{{User:Hamilton Abreu/testes/Thank you
|reason=*all your hard work and
*great looks
|signature=Joe}}
and
Example sunflower image
A little thank you...
for

dinner and

  • desert.
    hugs, Joe
{{User:Hamilton Abreu/testes/Thank you
|reason=dinner and
*desert
|signature=Joe}}
This last example looks a bit messy, though, so it might not fit your purpose. Hamilton Abreu 14:02, 5 February 2010 (UTC)
  • I ran into this exact same problem today while trying to create a template that is to contain an ordered list. Adding a line break doesn't seem to be a valid work around either. Would love to have some light shed on this situation. --Kjoz 20:50, 4 February 2010 (UTC)
    • Kjoz, adding a line break, followed by a new line, is a valid workaround: Hamilton Abreu 14:02, 5 February 2010 (UTC)
Example sunflower image
A little thank you...
for
  • all your hard work and
  • great looks.
    hugs, Joe
{{Thankyou
|reason=<br />
*all your hard work and
*great looks
|signature=Joe}}

[edit] Template Above Title - and possible lock

Hi, I have created a template with a Padlock to go on semi and full protected pages. It currently goes under the title, and I am wondering how I get it to go above (like Wikipedia). Also, if possible, is there a way that only Admins can add this template to pages. Thanks in Advance.

[edit] Big problem with templates.

Maybe it's just me, i've tried using a variety of different codes and followed a lot of peoples advice but i just cannot get templates to work for me. I've even tried using the advice above with the:

Your first argument:{{{1}}} Your second argument:{{{2}}}

But when i go to implement it on another page, all that shows up is "Template:First". It's the same with any template i try, it just comes up with the template name rather than the template itself.

Please can you help me as i'm stumped

Please state the exact name of the template page (including its namespace) and the exact statement you are using to transclude it. Hamilton Abreu 17:23, 19 January 2010 (UTC)

[edit] Defining parameters

Can one define a parameter within the Template? With a #switch function (for example) one can define an outcome, but I will want to use that outcome again and again in the Template without putting the whole #switch thing in again.

For example, a #switch on a parameter might have result options France=French | Germany=German | Austria=German etc, but what if I want to take the result ("French", "German" etc) and use it elsewhere? I ought to be able to say something along the lines "{{{lang}}}=X".

In VB one must "Dim" a variable, and then having given it a value and that variable can be used as often as you like. From what I have read, the only way I can think of doing it is to have a series of shell templates to hold the value and then feed it back. That cannot be right. I must have missed a trick.

Hogweard 22:16, 17 February 2010 (UTC)

[edit] Source code of the page has &lt;tr&gt;&lt;th&gt; instead <tr><th>

Hi, I tried to import the TODO_LIST Temaplate by "Special:Import" page. No any errors or warnings were not appeared after submiting the Import form. But template is showed incorrect. I see


<tr><th class="mbox-text" style="text-align:left; padding:1px;">Файл:Stock post message.svg To-do list for Шаблон:Todo:</th>
<td class="mbox-empty-cell"></td></tr> 

instead nice header of TODO List. What is wrong? Please note, that

<tr><th></th></tr>

tags are occures in edit box of this page. It is very strange, because MediaWiki has it own specification of tables creating.

Code from edit box:


{| class="{{talk other|demospace={{{demospace|}}}|tmbox tmbox-notice|ombox ombox-notice}} {{#ifeq:{{{small|}}}|yes|mbox-small}}
{{#ifeq:{{{collapsed|}}}|yes|collapsible collapsed}} t-todo" style="border-collapse:separate; {{{style|}}}" cellspacing="4"
<tr><th class="mbox-text" style="text-align:left; padding:1px;">{{ . . . 

It is real problem or, my own mistake? How can I fix it?

  • MediaWiki version: 1.15.1
  • PHP version: 5.2.10 (apache2handler)
  • MySQL version: 5.1.34-community
  • URL: http://vazia.no-ip.org/

Sorry for bad English :) —VaZia 21:35, 22 February 2010 (UTC)

In the wiki where you imported the template, edit the template. Go to the bottom of the page, check if any of the links to transcluded pages appear in red, and list the red ones here. Hamilton Abreu 01:31, 23 February 2010 (UTC)
I did not found any red links in the bottom of [3].--VaZia 21:32, 23 February 2010 (UTC)
If none are red then you're probably missing the tmbox and ombox classes in your CSS. Have a look at the bottom section of Help:Templates, see if that helps. Hamilton Abreu 01:44, 23 February 2010 (UTC)
Ok, I will check it. But I do not think that missing of CSS class can be cause of such bug in source of the page
&lt;tr&gt;&lt;th class="mbox-text" style="text-align:left; padding:1px;"&gt;
I saw it in FireBug. That is why pure html tags
<tr><th class="mbox-text" style="text-align:left; padding:1px;">Файл:Stock post message.svg To-do list for Шаблон:Todo:</th><td class="mbox-empty-cell"></td></tr>
appears on the http://vazia.no-ip.org/index.php/Template:Todo page.--VaZia 21:32, 23 February 2010 (UTC)
Yes, you're right about CSS not being the cause. It seems that your wiki is not allowing the use of the <tr> and <th> HTML tags, although in principle they should be allowed. Check MetaWiki:Help:HTML_in_wikitext for more details on this. I tried in your wiki to change the HTML tags to the WikiText equivalent; for example, replacing the line
<tr><th class="mbox-text" style="text-align:left; padding:1px;">{{
in the template, by
! class="mbox-text" style="text-align:left; padding:1px;" |{{
(notice the | before the {{) should produce the adequate <tr> and <th> HTML tags in the output instead of &lt;tr&gt;&lt;th&gt;. But your wiki just went down and became unavailable, so I couldn't test replacing the rest. Anyway, do you see where I'm going with this? Maybe you can try replacing the rest of them for the WikiText equivalent; the thing is, if in wikipedia the template is using the HTML tags instead of the WikiText, they're probably doing something funky that may not be possible to achieve with WikiText. So, the proper solution is to figure out why your wiki is not allowing the <tr> and <th> HTML tags in the first place. But I'm at the limits of my knowledge there. Perhaps someone more knowledgeable will read this and help. Hamilton Abreu 01:23, 24 February 2010 (UTC)
Hamilton Abreu, thank you for your attention! Yes, template can be fixed by using |-,|,! instead <tr>,<td>,<th> or native table tags instead wiki markup for tables. But question is opened as before. Why my wiki is not allowing the use of the <tr> and <th> HTML tags? Now, I found the related link and will go there --VaZia 09:20, 24 February 2010 (UTC)
Do you know HTML? It strikes me that the usual way to define a table would be:
<table>
  <tr>
    <th></th>
    <th></th>
  </tr>
  <tr>
    <td></td>
    <td></td>
  </tr>
</table>

But the template does:

<table>
  <tr>
    <th></th>
    <td></td>
  </tr>
  ...

mixing the <th> and <td> HTML tags inside a <tr>. I'm way out of my depth here, but maybe the template uses non-standard HTML (a trick) that MediaWiki identifies and tries to erase. Possibly related to the $wgUseTidy thing that the documentation keeps referring to, which seems to fix bad HTML. If this were the case, then wikipedia has the $wgUseTidy thingy and your wiki doesn't. Or the other way round: $wgUseTidy causes this, wikipedia doesn't use it and your wiki does. But please keep in mind that this is just an idea, I don't know what I'm talking about, at all. :-) Hamilton Abreu 15:02, 24 February 2010 (UTC)